Loading Libraries:

library(mgcv)
## Loading required package: nlme
## This is mgcv 1.8-40. For overview type 'help("mgcv-package")'.
library(here)
## here() starts at C:/Users/hensl/Downloads/NOAA IN FISH! Internship/IN FISH Woods Hole Project
library(dplyr)
## 
## Attaching package: 'dplyr'
## The following object is masked from 'package:nlme':
## 
##     collapse
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
library(ggplot2)
library(ggpubr)

Loading In Data:

setwd("C:/Users/hensl/Downloads/NOAA IN FISH! Internship/IN FISH Woods Hole Project")
data_comb <- read.csv("GAM Data/updated cb ratios.csv")

Converting the species codes (svspp) to common names, just for ease of reference for myself:

data_comb$svspp[data_comb$svspp == 15] <- 'Spiny.Dogfish'
data_comb$svspp[data_comb$svspp == 23] <- 'Winter.Skate'
data_comb$svspp[data_comb$svspp == 75] <- 'Pollock'
data_comb$svspp[data_comb$svspp == 76] <- 'White.Hake'
data_comb$svspp[data_comb$svspp == 77] <- 'Red.Hake'
data_comb$svspp[data_comb$svspp == 197] <- 'Goosefish'
data_comb$svspp[data_comb$svspp == 28] <- 'Thorny.Skate'
data_comb$svspp[data_comb$svspp == 73] <- 'Atlantic.Cod'
data_comb$svspp[data_comb$svspp == 164] <- 'Sea.Raven'
data_comb$svspp[data_comb$svspp == 72] <- 'Silver.Hake'
data_comb$svspp[data_comb$svspp == 103] <- 'Summer.Flounder'
data_comb$svspp[data_comb$svspp == 104] <- 'Fourspot.Flounder'
data_comb$svspp[data_comb$svspp == 108] <- 'Windowpane'
data_comb$svspp[data_comb$svspp == 112] <- 'Buckler.Dory'
data_comb$svspp[data_comb$svspp == 135] <- 'Blue.Fish'
data_comb$svspp[data_comb$svspp == 163] <- 'Longhorn.Sculpin'
data_comb$svspp[data_comb$svspp == 172] <- 'Striped.Searobin'

Filtering the data to only show “all” prey types, so I can analyze total consumption:

data_comb_f <- filter(data_comb, prey == 'all')

Removing NA’s:

data_comb_f <- data_comb_f %>% na.omit(cb)

Filtering the dataset to focus only on spring samples:

dc_spring <- filter(data_comb_f, seacat == 'SPRING')

Building generalized linear models and generalized additive models broken down by each study species: (For the GLM plots, I used the geom_gls() function from the ecodata package so that trend lines would only appear on the plots if a significant trend was detected. For the GAMs, I built the models to the best fit model (lowest AIC value), and therefore the functional set up of the GAMs between some of the species are different. I did additionally z-score the bottom temperature data when using it in the model, but wasn’t sure if this was appropriate to do, especially since the bottom temperature is incorporated into the model output of consumption:biomass values. In case it was something we explored, I incorporated the information in these models presented below and switched between the z-scored bottom temperature and raw bottom temperature depending on which produced a better model output. I would like to note for this that sometimes the trend depicted via the z-scored bottom temperature versus the raw bottom temperature was vastly different. Please let me know your thoughts!)

## Spiny Dogfish
### GLM
dc_spring_s.d <- filter(dc_spring, svspp == 'Spiny.Dogfish')
s.d_plot <- ggplot(data = dc_spring_s.d, aes(x = year, y = cb)) +
  geom_point(color = "black", size = 1) +
  ecodata::geom_gls() +
  theme_bw() +
  theme(plot.title = element_text(size = 13)) +
  xlab("Year") +
  ylab("Consumption:Biomass") +
  scale_x_continuous(expand = expansion(mult = c(0.01, 0.02))) +
  scale_y_continuous(expand = expansion(mult = c(0.02, 0.02))) +
  theme(axis.text.x=element_text(size=10), 
        axis.text.y = element_text(size=10),
        axis.title.y=element_text(size = 10),
        axis.title.x=element_text(size = 10)) +
  ggtitle("Spiny Dogfish")
s.d_plot

### GAM
dc_spring_s.d <- filter(dc_spring, svspp == 'Spiny.Dogfish')
dc_spring_s.d$z_bt <- (dc_spring_s.d$bt - mean(dc_spring_s.d$bt))/(dc_spring_s.d$bt_sd)
mod1 <- gam(cb ~ s(year) + s(bt), data=dc_spring_s.d, family = 'gaussian')
summary(mod1)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## cb ~ s(year) + s(bt)
## 
## Parametric coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  0.20015    0.01754   11.41 3.15e-14 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##           edf Ref.df     F p-value  
## s(year) 2.493  3.103 4.172  0.0113 *
## s(bt)   1.000  1.000 3.122  0.0847 .
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.224   Deviance explained = 28.6%
## GCV = 0.015381  Scale est. = 0.013845  n = 45
mod1$aic
## [1] -58.63464
plot(mod1, pages=1, scheme=1, unconditional=TRUE, main = "Spiny Dogfish")
## Warning in plot.gam(mod1, pages = 1, scheme = 1, unconditional = TRUE, main =
## "Spiny Dogfish"): Smoothness uncertainty corrected covariance not available

gam.check(mod1)

## 
## Method: GCV   Optimizer: magic
## Smoothing parameter selection converged after 11 iterations.
## The RMS GCV score gradient at convergence was 1.078509e-07 .
## The Hessian was positive definite.
## Model rank =  19 / 19 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##           k'  edf k-index p-value
## s(year) 9.00 2.49    1.00    0.44
## s(bt)   9.00 1.00    1.09    0.66
## Winter Skate
### GLM
dc_spring_w.s <- filter(dc_spring, svspp == 'Winter.Skate')
w.s_plot <- ggplot(data = dc_spring_w.s,aes(x = year, y = cb)) +
  geom_point(color = "black", size = 1) +
  ecodata::geom_gls() +
  theme_bw() +
  theme(plot.title = element_text(size = 13)) +
  xlab("Year") +
  ylab("Consumption:Biomass") +
  scale_x_continuous(expand = expansion(mult = c(0.01, 0.02))) +
  scale_y_continuous(expand = expansion(mult = c(0.02, 0.02))) +
  theme(axis.text.x=element_text(size=10), 
        axis.text.y = element_text(size=10),
        axis.title.y=element_text(size = 10),
        axis.title.x=element_text(size = 10)) +
  ggtitle("Winter Skate")
w.s_plot

### GAM
dc_spring_w.s <- filter(dc_spring, svspp == 'Winter.Skate')
dc_spring_w.s$z_bt <- (dc_spring_w.s$bt - mean(dc_spring_w.s$bt))/(dc_spring_w.s$bt_sd)
mod2 <- gam(cb ~ s(year) + s(bt), data=dc_spring_w.s, family = 'gaussian')
summary(mod2)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## cb ~ s(year) + s(bt)
## 
## Parametric coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  0.17202    0.01246   13.81   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##           edf Ref.df     F  p-value    
## s(year) 2.778  3.468 6.214 0.000999 ***
## s(bt)   1.702  2.099 0.579 0.618832    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.335   Deviance explained = 40.4%
## GCV = 0.0077977  Scale est. = 0.0068266  n = 44
mod2$aic
## [1] -87.45114
plot(mod2, pages=1, scheme=1, unconditional=TRUE, main = "Winter Skate")
## Warning in plot.gam(mod2, pages = 1, scheme = 1, unconditional = TRUE, main =
## "Winter Skate"): Smoothness uncertainty corrected covariance not available

gam.check(mod2)

## 
## Method: GCV   Optimizer: magic
## Smoothing parameter selection converged after 4 iterations.
## The RMS GCV score gradient at convergence was 4.815412e-07 .
## The Hessian was positive definite.
## Model rank =  19 / 19 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##           k'  edf k-index p-value
## s(year) 9.00 2.78    1.00    0.42
## s(bt)   9.00 1.70    1.07    0.62
## Pollock
### GLM
dc_spring_p <- filter(dc_spring, svspp == 'Pollock')
p_plot <- ggplot(data = dc_spring_p, aes(x = year, y = cb)) +
  geom_point(color = "black", size = 1) +
  ecodata::geom_gls() +
  theme_bw() +
  theme(plot.title = element_text(size = 13)) +
  xlab("Year") +
  ylab("Consumption:Biomass") +
  scale_x_continuous(expand = expansion(mult = c(0.01, 0.02))) +
  scale_y_continuous(expand = expansion(mult = c(0.02, 0.02))) +
  theme(axis.text.x=element_text(size=10), 
        axis.text.y = element_text(size=10),
        axis.title.y=element_text(size = 10),
        axis.title.x=element_text(size = 10)) +
  ggtitle("Pollock")
p_plot

### GAM
dc_spring_p <- filter(dc_spring, svspp == 'Pollock')
dc_spring_p$z_bt <- (dc_spring_p$bt - mean(dc_spring_p$bt))/(dc_spring_p$bt_sd)
mod3 <- gam(cb ~ s(year) + s(bt), data=dc_spring_p, family = 'gaussian')
summary(mod3)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## cb ~ s(year) + s(bt)
## 
## Parametric coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  0.27819    0.03223   8.632 8.69e-11 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##           edf Ref.df     F p-value
## s(year) 1.210  1.387 3.008   0.126
## s(bt)   3.543  4.395 1.777   0.160
## 
## R-sq.(adj) =  0.195   Deviance explained = 27.8%
## GCV = 0.055624  Scale est. = 0.048815  n = 47
mod3$aic
## [1] -1.176771
plot(mod3, pages=1, scheme=1, unconditional=TRUE, main = "Pollock")
## Warning in plot.gam(mod3, pages = 1, scheme = 1, unconditional = TRUE, main =
## "Pollock"): Smoothness uncertainty corrected covariance not available

gam.check(mod3)

## 
## Method: GCV   Optimizer: magic
## Smoothing parameter selection converged after 23 iterations.
## The RMS GCV score gradient at convergence was 8.334921e-07 .
## The Hessian was positive definite.
## Model rank =  19 / 19 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##           k'  edf k-index p-value
## s(year) 9.00 1.21    1.00    0.47
## s(bt)   9.00 3.54    1.16    0.85
## White Hake
### GLM
dc_spring_w.h <- filter(dc_spring, svspp == 'White.Hake')
w.h_plot <- ggplot(data = dc_spring_w.h, aes(x = year, y = cb)) +
  geom_point(color = "black", size = 1) +
  ecodata::geom_gls() +
  theme_bw() +
  theme(plot.title = element_text(size = 13)) +
  xlab("Year") +
  ylab("Consumption:Biomass") +
  scale_x_continuous(expand = expansion(mult = c(0.01, 0.02))) +
  scale_y_continuous(expand = expansion(mult = c(0.02, 0.02))) +
  theme(axis.text.x=element_text(size=10), 
        axis.text.y = element_text(size=10),
        axis.title.y=element_text(size = 10),
        axis.title.x=element_text(size = 10)) +
  ggtitle("White Hake")
w.h_plot

### GAM
dc_spring_w.h <- filter(dc_spring, svspp == 'White.Hake')
dc_spring_w.h$z_bt <- (dc_spring_w.h$bt - mean(dc_spring_w.h$bt))/(dc_spring_w.h$bt_sd)
mod4 <- gam(cb ~ s(year) + s(bt), data=dc_spring_w.h, family = 'gaussian')
summary(mod4)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## cb ~ s(year) + s(bt)
## 
## Parametric coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)   0.6946     0.1131   6.142 4.36e-07 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##           edf Ref.df     F p-value  
## s(year) 1.000  1.000 0.030  0.8630  
## s(bt)   8.735  8.978 3.004  0.0101 *
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.298   Deviance explained = 44.7%
## GCV = 0.77902  Scale est. = 0.60109   n = 47
mod4$aic
## [1] 120.74
plot(mod4, pages=1, scheme=1, unconditional=TRUE, main = "White Hake")
## Warning in plot.gam(mod4, pages = 1, scheme = 1, unconditional = TRUE, main =
## "White Hake"): Smoothness uncertainty corrected covariance not available

gam.check(mod4)

## 
## Method: GCV   Optimizer: magic
## Smoothing parameter selection converged after 16 iterations.
## The RMS GCV score gradient at convergence was 1.598817e-07 .
## The Hessian was positive definite.
## Model rank =  19 / 19 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##           k'  edf k-index p-value
## s(year) 9.00 1.00    0.96    0.30
## s(bt)   9.00 8.73    1.46    0.99
## Red Hake
### GLM
dc_spring_r.h <- filter(dc_spring, svspp == 'Red.Hake')
r.h_plot <- ggplot(data = dc_spring_r.h, aes(x = year, y = cb)) +
  geom_point(color = "black", size = 1) +
  ecodata::geom_gls() +
  theme_bw() +
  theme(plot.title = element_text(size = 13)) +
  xlab("Year") +
  ylab("Consumption:Biomass") +
  scale_x_continuous(expand = expansion(mult = c(0.01, 0.02))) +
  scale_y_continuous(expand = expansion(mult = c(0.02, 0.02))) +
  theme(axis.text.x=element_text(size=10), 
        axis.text.y = element_text(size=10),
        axis.title.y=element_text(size = 10),
        axis.title.x=element_text(size = 10)) +
  ggtitle("Red Hake")
r.h_plot

### GAM
dc_spring_r.h <- filter(dc_spring, svspp == 'Red.Hake')
dc_spring_r.h$z_bt <- (dc_spring_r.h$bt - mean(dc_spring_r.h$bt))/(dc_spring_r.h$bt_sd)
mod5 <- gam(cb ~ s(year) + s(bt), data=dc_spring_r.h, family = 'gaussian')
summary(mod5)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## cb ~ s(year) + s(bt)
## 
## Parametric coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)   0.4836     0.1033   4.681 2.99e-05 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##           edf Ref.df     F p-value
## s(year) 4.497  5.509 1.442   0.233
## s(bt)   1.575  1.938 0.912   0.467
## 
## R-sq.(adj) =   0.11   Deviance explained = 22.2%
## GCV = 0.61135  Scale est. = 0.52311   n = 49
mod5$aic
## [1] 115.8128
plot(mod5, pages=1, scheme=1, unconditional=TRUE, main = "Red Hake")
## Warning in plot.gam(mod5, pages = 1, scheme = 1, unconditional = TRUE, main =
## "Red Hake"): Smoothness uncertainty corrected covariance not available

gam.check(mod5)

## 
## Method: GCV   Optimizer: magic
## Smoothing parameter selection converged after 6 iterations.
## The RMS GCV score gradient at convergence was 1.143809e-05 .
## The Hessian was positive definite.
## Model rank =  19 / 19 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##           k'  edf k-index p-value
## s(year) 9.00 4.50    1.20    0.98
## s(bt)   9.00 1.57    0.92    0.12
## Goosefish
### GLM
dc_spring_g <- filter(dc_spring, svspp == 'Goosefish')
g_plot <- ggplot(data = dc_spring_g, aes(x = year, y = cb)) +
  geom_point(color = "black", size = 1) +
  ecodata::geom_gls() +
  theme_bw() +
  theme(plot.title = element_text(size = 13)) +
  xlab("Year") +
  ylab("Consumption:Biomass") +
  scale_x_continuous(expand = expansion(mult = c(0.01, 0.02))) +
  scale_y_continuous(expand = expansion(mult = c(0.02, 0.02))) +
  theme(axis.text.x=element_text(size=10), 
        axis.text.y = element_text(size=10),
        axis.title.y=element_text(size = 10),
        axis.title.x=element_text(size = 10)) +
  ggtitle("Goosefish")
g_plot

### GAM
dc_spring_g <- filter(dc_spring, svspp == 'Goosefish')
dc_spring_g$z_bt <- (dc_spring_g$bt - mean(dc_spring_g$bt))/(dc_spring_g$bt_sd)
mod6 <- gam(cb ~ s(year) + s(bt), data=dc_spring_g, family = 'gaussian')
summary(mod6)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## cb ~ s(year) + s(bt)
## 
## Parametric coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  0.65685    0.03935   16.69   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##          edf Ref.df     F  p-value    
## s(year) 7.68  8.558 4.387 0.000821 ***
## s(bt)   1.00  1.000 0.082 0.776613    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.444   Deviance explained = 55.4%
## GCV = 0.088772  Scale est. = 0.069677  n = 45
mod6$aic
## [1] 18.28955
plot(mod6, pages=1, scheme=1, unconditional=TRUE, main = "Goosefish")
## Warning in plot.gam(mod6, pages = 1, scheme = 1, unconditional = TRUE, main =
## "Goosefish"): Smoothness uncertainty corrected covariance not available

gam.check(mod6)

## 
## Method: GCV   Optimizer: magic
## Smoothing parameter selection converged after 15 iterations.
## The RMS GCV score gradient at convergence was 6.951738e-08 .
## The Hessian was positive definite.
## Model rank =  19 / 19 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##           k'  edf k-index p-value
## s(year) 9.00 7.68    1.29    0.96
## s(bt)   9.00 1.00    0.95    0.34
## Thorny Skate
### GLM
dc_spring_t.s <- filter(dc_spring, svspp == 'Thorny.Skate')
t.s_plot <- ggplot(data = dc_spring_t.s, aes(x = year, y = cb)) +
  geom_point(color = "black", size = 1) +
  ecodata::geom_gls() +
  theme_bw() +
  theme(plot.title = element_text(size = 13)) +
  xlab("Year") +
  ylab("Consumption:Biomass") +
  scale_x_continuous(expand = expansion(mult = c(0.02, 0.02))) +
  scale_y_continuous(expand = expansion(mult = c(0.02, 0.02))) +
  theme(axis.text.x=element_text(size=10), 
        axis.text.y = element_text(size=10),
        axis.title.y=element_text(size = 10),
        axis.title.x=element_text(size = 10)) +
  ggtitle("Thorny Skate")
t.s_plot

### GAM
dc_spring_t.s <- filter(dc_spring, svspp == 'Thorny.Skate')
dc_spring_t.s$z_bt <- (dc_spring_t.s$bt - mean(dc_spring_t.s$bt))/(dc_spring_t.s$bt_sd)
mod7 <- gam(cb ~ s(year) + s(bt), data=dc_spring_t.s, family = 'gaussian')
summary(mod7)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## cb ~ s(year) + s(bt)
## 
## Parametric coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  0.23653    0.02141   11.05 9.69e-13 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##           edf Ref.df     F p-value  
## s(year) 5.487  6.584 2.418  0.0442 *
## s(bt)   1.831  2.296 3.991  0.0195 *
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.496   Deviance explained = 58.6%
## GCV = 0.024008  Scale est. = 0.019254  n = 42
mod7$aic
## [1] -37.34534
plot(mod7, pages=1, scheme=1, unconditional=TRUE, main = "Thorny Skate")
## Warning in plot.gam(mod7, pages = 1, scheme = 1, unconditional = TRUE, main =
## "Thorny Skate"): Smoothness uncertainty corrected covariance not available

gam.check(mod7)

## 
## Method: GCV   Optimizer: magic
## Smoothing parameter selection converged after 6 iterations.
## The RMS GCV score gradient at convergence was 6.747403e-07 .
## The Hessian was positive definite.
## Model rank =  19 / 19 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##           k'  edf k-index p-value
## s(year) 9.00 5.49    1.01    0.42
## s(bt)   9.00 1.83    1.43    1.00
## Atlantic Cod
### GLM
dc_spring_a.c <- filter(dc_spring, svspp == 'Atlantic.Cod')
a.c_plot <- ggplot(data = dc_spring_a.c,aes(x = year, y = cb)) +
  geom_point(color = "black", size = 1) +
  ecodata::geom_gls() +
  theme_bw() +
  theme(plot.title = element_text(size = 13)) +
  xlab("Year") +
  ylab("Consumption:Biomass") +
  scale_x_continuous(expand = expansion(mult = c(0.02, 0.02))) +
  scale_y_continuous(expand = expansion(mult = c(0.02, 0.02))) +
  theme(axis.text.x=element_text(size=10), 
        axis.text.y = element_text(size=10),
        axis.title.y=element_text(size = 10),
        axis.title.x=element_text(size = 10)) +
  ggtitle("Atlantic Cod")
a.c_plot

### GAM
dc_spring_a.c <- filter(dc_spring, svspp == 'Atlantic.Cod')
dc_spring_a.c$z_bt <- (dc_spring_a.c$bt - mean(dc_spring_a.c$bt))/(dc_spring_a.c$bt_sd)
mod8 <- gam(cb ~ s(year) + s(bt), data=dc_spring_a.c, family = 'gaussian')
summary(mod8)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## cb ~ s(year) + s(bt)
## 
## Parametric coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  0.44934    0.02868   15.66   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##          edf Ref.df     F p-value  
## s(year) 1.00  1.000 1.569  0.2173  
## s(bt)   2.53  3.183 4.162  0.0104 *
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.291   Deviance explained = 34.6%
## GCV = 0.042795  Scale est. = 0.03867   n = 47
mod8$aic
## [1] -13.19981
plot(mod8, pages=1, scheme=1, unconditional=TRUE, main = "Atlantic Cod")
## Warning in plot.gam(mod8, pages = 1, scheme = 1, unconditional = TRUE, main =
## "Atlantic Cod"): Smoothness uncertainty corrected covariance not available

gam.check(mod8)

## 
## Method: GCV   Optimizer: magic
## Smoothing parameter selection converged after 13 iterations.
## The RMS GCV score gradient at convergence was 5.122689e-08 .
## The Hessian was positive definite.
## Model rank =  19 / 19 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##           k'  edf k-index p-value
## s(year) 9.00 1.00    1.32    0.99
## s(bt)   9.00 2.53    1.03    0.46
## Sea Raven
### GLM
dc_spring_s.r <- filter(dc_spring, svspp == 'Sea.Raven')
s.r_plot <- ggplot(data = dc_spring_s.r, aes(x = year, y = cb)) +
  geom_point(color = "black", size = 1) +
  ecodata::geom_gls() +
  theme_bw() +
  theme(plot.title = element_text(size = 13)) +
  xlab("Year") +
  ylab("Consumption:Biomass") +
  scale_x_continuous(expand = expansion(mult = c(0.02, 0.02))) +
  scale_y_continuous(expand = expansion(mult = c(0.02, 0.02))) +
  theme(axis.text.x=element_text(size=10), 
        axis.text.y = element_text(size=10),
        axis.title.y=element_text(size = 10),
        axis.title.x=element_text(size = 10)) +
  ggtitle("Sea Raven")
s.r_plot

### GAM
dc_spring_s.r <- filter(dc_spring, svspp == 'Sea.Raven')
dc_spring_s.r$z_bt <- (dc_spring_s.r$bt - mean(dc_spring_s.r$bt))/(dc_spring_s.r$bt_sd)
mod9 <- gam(cb ~ s(year) + s(bt), data=dc_spring_s.r, family = 'gaussian')
summary(mod9)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## cb ~ s(year) + s(bt)
## 
## Parametric coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  0.57923    0.04025   14.39 2.53e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##          edf Ref.df     F p-value   
## s(year) 5.76  6.912 4.577 0.00119 **
## s(bt)   1.00  1.000 3.414 0.07311 . 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.537   Deviance explained = 61.2%
## GCV = 0.085001  Scale est. = 0.069661  n = 43
mod9$aic
## [1] 16.43412
plot(mod9, pages=1, scheme=1, unconditional=TRUE, main = "Sea Raven")
## Warning in plot.gam(mod9, pages = 1, scheme = 1, unconditional = TRUE, main =
## "Sea Raven"): Smoothness uncertainty corrected covariance not available

gam.check(mod9)

## 
## Method: GCV   Optimizer: magic
## Smoothing parameter selection converged after 10 iterations.
## The RMS GCV score gradient at convergence was 1.08166e-07 .
## The Hessian was positive definite.
## Model rank =  19 / 19 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##           k'  edf k-index p-value
## s(year) 9.00 5.76    1.25    0.94
## s(bt)   9.00 1.00    1.22    0.92
## Silver Hake
### GLM
dc_spring_s.h <- filter(dc_spring, svspp == 'Silver.Hake')
s.h_plot <- ggplot(data = dc_spring_s.h, aes(x = year, y = cb)) +
  geom_point(color = "black", size = 1) +
  ecodata::geom_gls() +
  theme_bw() +
  theme(plot.title = element_text(size = 13)) +
  xlab("Year") +
  ylab("Consumption:Biomass") +
  scale_x_continuous(expand = expansion(mult = c(0.02, 0.02))) +
  scale_y_continuous(expand = expansion(mult = c(0.02, 0.02))) +
  theme(axis.text.x=element_text(size=10), 
        axis.text.y = element_text(size=10),
        axis.title.y=element_text(size = 10),
        axis.title.x=element_text(size = 10)) +
  ggtitle("Silver Hake")
s.h_plot

### GAM
dc_spring_s.h <- filter(dc_spring, svspp == 'Silver.Hake')
dc_spring_s.h$z_bt <- (dc_spring_s.h$bt - mean(dc_spring_s.h$bt))/(dc_spring_s.h$bt_sd)
mod10 <- gam(cb ~ s(year) + s(bt), data=dc_spring_s.h, family = 'gaussian')
summary(mod10)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## cb ~ s(year) + s(bt)
## 
## Parametric coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  0.68063    0.06495   10.48 9.59e-13 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##          edf Ref.df     F p-value  
## s(year) 1.00  1.000 1.536   0.223  
## s(bt)   8.15  8.792 2.416   0.038 *
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.242   Deviance explained = 38.9%
## GCV = 0.25678  Scale est. = 0.20248   n = 48
mod10$aic
## [1] 70.45327
plot(mod10, pages=1, scheme=1, unconditional=TRUE, main = "Silver Hake")
## Warning in plot.gam(mod10, pages = 1, scheme = 1, unconditional = TRUE, :
## Smoothness uncertainty corrected covariance not available

gam.check(mod10)

## 
## Method: GCV   Optimizer: magic
## Smoothing parameter selection converged after 13 iterations.
## The RMS GCV score gradient at convergence was 9.120739e-08 .
## The Hessian was positive definite.
## Model rank =  19 / 19 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##           k'  edf k-index p-value
## s(year) 9.00 1.00    0.96    0.39
## s(bt)   9.00 8.15    1.04    0.56
## Summer Flounder
### GLM
dc_spring_s.f <- filter(dc_spring, svspp == 'Summer.Flounder')
s.f_plot <- ggplot(data = dc_spring_s.f, aes(x = year, y = cb)) +
  geom_point(color = "black", size = 1) +
  ecodata::geom_gls() +
  theme_bw() +
  theme(plot.title = element_text(size = 13)) +
  xlab("Year") +
  ylab("Consumption:Biomass") +
  scale_x_continuous(expand = expansion(mult = c(0.02, 0.02))) +
  scale_y_continuous(expand = expansion(mult = c(0.02, 0.02))) +
  theme(axis.text.x=element_text(size=10), 
        axis.text.y = element_text(size=10),
        axis.title.y=element_text(size = 10),
        axis.title.x=element_text(size = 10)) +
  ggtitle("Summer Flounder")
s.f_plot

### GAM
dc_spring_s.f <- filter(dc_spring, svspp == 'Summer.Flounder')
dc_spring_s.f$z_bt <- (dc_spring_s.f$bt - mean(dc_spring_s.f$bt))/(dc_spring_s.f$bt_sd)
mod11 <- gam(cb ~ s(year) + s(bt), data=dc_spring_s.f, family = 'gaussian')
summary(mod11)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## cb ~ s(year) + s(bt)
## 
## Parametric coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  0.16049    0.01912   8.395 1.58e-10 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##         edf Ref.df     F p-value
## s(year)   1      1 1.029   0.316
## s(bt)     1      1 1.088   0.303
## 
## R-sq.(adj) =  -0.00212   Deviance explained = 4.34%
## GCV = 0.017621  Scale est. = 0.016446  n = 45
mod11$aic
## [1] -52.24465
plot(mod11, pages=1, scheme=1, unconditional=TRUE, main = "Summer Flounder")
## Warning in plot.gam(mod11, pages = 1, scheme = 1, unconditional = TRUE, :
## Smoothness uncertainty corrected covariance not available

gam.check(mod11)

## 
## Method: GCV   Optimizer: magic
## Smoothing parameter selection converged after 12 iterations.
## The RMS GCV score gradient at convergence was 3.793624e-08 .
## The Hessian was positive definite.
## Model rank =  19 / 19 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##         k' edf k-index p-value
## s(year)  9   1    0.98    0.35
## s(bt)    9   1    1.21    0.90
## Fourspot Flounder
### GLM
dc_spring_f.f <- filter(dc_spring, svspp == 'Fourspot.Flounder')
f.f_plot <- ggplot(data = dc_spring_f.f, aes(x = year, y = cb)) +
  geom_point(color = "black", size = 1) +
  ecodata::geom_gls() +
  theme_bw() +
  theme(plot.title = element_text(size = 13)) +
  xlab("Year") +
  ylab("Consumption:Biomass") +
  scale_x_continuous(expand = expansion(mult = c(0.02, 0.02))) +
  scale_y_continuous(expand = expansion(mult = c(0.02, 0.02))) +
  theme(axis.text.x=element_text(size=10), 
        axis.text.y = element_text(size=10),
        axis.title.y=element_text(size = 10),
        axis.title.x=element_text(size = 10)) +
  ggtitle("Fourspot Flounder")
f.f_plot

### GAM
dc_spring_f.f <- filter(dc_spring, svspp == 'Fourspot.Flounder')
dc_spring_f.f$z_bt <- (dc_spring_f.f$bt - mean(dc_spring_f.f$bt))/(dc_spring_f.f$bt_sd)
mod12 <- gam(cb ~ s(year) + s(bt), data=dc_spring_f.f, family = 'gaussian')
summary(mod12)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## cb ~ s(year) + s(bt)
## 
## Parametric coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  0.12578    0.01143      11 3.78e-13 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##           edf Ref.df     F  p-value    
## s(year) 6.101  7.236 4.636 0.000749 ***
## s(bt)   2.360  2.943 2.679 0.072895 .  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.481   Deviance explained = 57.8%
## GCV = 0.0075719  Scale est. = 0.0060146  n = 46
mod12$aic
## [1] -94.35158
plot(mod12, pages=1, scheme=1, unconditional=TRUE, main = "Fourspot Flounder")
## Warning in plot.gam(mod12, pages = 1, scheme = 1, unconditional = TRUE, :
## Smoothness uncertainty corrected covariance not available

gam.check(mod12)

## 
## Method: GCV   Optimizer: magic
## Smoothing parameter selection converged after 8 iterations.
## The RMS GCV score gradient at convergence was 7.74027e-08 .
## The Hessian was positive definite.
## Model rank =  19 / 19 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##           k'  edf k-index p-value
## s(year) 9.00 6.10    0.99    0.46
## s(bt)   9.00 2.36    0.98    0.38
## Windowpane
### GLM
dc_spring_w <- filter(dc_spring, svspp == 'Windowpane')
w_plot <- ggplot(data = dc_spring_w, aes(x = year, y = cb)) +
  geom_point(color = "black", size = 1) +
  ecodata::geom_gls() +
  theme_bw() +
  theme(plot.title = element_text(size = 13)) +
  xlab("Year") +
  ylab("Consumption:Biomass") +
  scale_x_continuous(expand = expansion(mult = c(0.02, 0.02))) +
  scale_y_continuous(expand = expansion(mult = c(0.02, 0.02))) +
  theme(axis.text.x=element_text(size=10), 
        axis.text.y = element_text(size=10),
        axis.title.y=element_text(size = 10),
        axis.title.x=element_text(size = 10)) +
  ggtitle("Windowpane")
w_plot

### GAM
dc_spring_w <- filter(dc_spring, svspp == 'Windowpane')
dc_spring_w$z_bt <- (dc_spring_w$bt - mean(dc_spring_w$bt))/(dc_spring_w$bt_sd)
mod13 <- gam(cb ~ s(year) + s(bt), data=dc_spring_w, family = 'gaussian')
summary(mod13)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## cb ~ s(year) + s(bt)
## 
## Parametric coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  0.20945    0.02312   9.061 2.44e-11 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##         edf Ref.df     F p-value
## s(year)   1      1 0.694   0.409
## s(bt)     1      1 0.388   0.537
## 
## R-sq.(adj) =  -0.00309   Deviance explained = 4.36%
## GCV = 0.02523  Scale est. = 0.02351   n = 44
mod13$aic
## [1] -35.25549
plot(mod13, pages=1, scheme=1, unconditional=TRUE, main = "Windowpane")
## Warning in plot.gam(mod13, pages = 1, scheme = 1, unconditional = TRUE, :
## Smoothness uncertainty corrected covariance not available

gam.check(mod13)

## 
## Method: GCV   Optimizer: magic
## Smoothing parameter selection converged after 12 iterations.
## The RMS GCV score gradient at convergence was 3.800415e-08 .
## The Hessian was positive definite.
## Model rank =  19 / 19 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##         k' edf k-index p-value
## s(year)  9   1    1.28    0.98
## s(bt)    9   1    1.07    0.58
## Buckler Dory
### GLM
dc_spring_b.d <- filter(dc_spring, svspp == 'Buckler.Dory')
b.d_plot <- ggplot(data = dc_spring_b.d, aes(x = year, y = cb)) +
  geom_point(color = "black", size = 1) +
  ecodata::geom_gls() +
  theme_bw() +
  theme(plot.title = element_text(size = 13)) +
  xlab("Year") +
  ylab("Consumption:Biomass") +
  scale_x_continuous(expand = expansion(mult = c(0.02, 0.02))) +
  scale_y_continuous(expand = expansion(mult = c(0.02, 0.02))) +
  theme(axis.text.x=element_text(size=10), 
        axis.text.y = element_text(size=10),
        axis.title.y=element_text(size = 10),
        axis.title.x=element_text(size = 10)) +
  ggtitle("Buckler Dory")
b.d_plot

### GAM
dc_spring_b.d <- filter(dc_spring, svspp == 'Buckler.Dory')
dc_spring_b.d$z_bt <- (dc_spring_b.d$bt - mean(dc_spring_b.d$bt))/(dc_spring_b.d$bt_sd)
mod14 <- gam(cb ~ s(year) , data=dc_spring_b.d, family = 'gaussian')
mod14.a <- gam(cb ~ s(bt) , data=dc_spring_b.d, family = 'gaussian')
summary(mod14)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## cb ~ s(year)
## 
## Parametric coefficients:
##             Estimate Std. Error t value Pr(>|t|)  
## (Intercept)   0.2483     0.1077   2.306   0.0351 *
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##           edf Ref.df     F p-value
## s(year) 1.257  1.464 0.162   0.875
## 
## R-sq.(adj) =  -0.0397   Deviance explained = 3.72%
## GCV = 0.23872  Scale est. = 0.2088    n = 18
summary(mod14.a)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## cb ~ s(bt)
## 
## Parametric coefficients:
##             Estimate Std. Error t value Pr(>|t|)   
## (Intercept)   0.2483     0.0812   3.058  0.00887 **
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##         edf Ref.df     F p-value  
## s(bt) 3.585  4.378 2.851  0.0662 .
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.409   Deviance explained = 53.4%
## GCV = 0.15923  Scale est. = 0.11867   n = 18
mod14$aic
## [1] 26.98878
mod14.a$aic
## [1] 18.59422
plot(mod14, pages=1, scheme=1, unconditional=TRUE, main = "Buckler Dory")
## Warning in plot.gam(mod14, pages = 1, scheme = 1, unconditional = TRUE, :
## Smoothness uncertainty corrected covariance not available

plot(mod14.a, pages=1, scheme=1, unconditional=TRUE, main = "Buckler Dory")
## Warning in plot.gam(mod14.a, pages = 1, scheme = 1, unconditional = TRUE, :
## Smoothness uncertainty corrected covariance not available

gam.check(mod14)

## 
## Method: GCV   Optimizer: magic
## Smoothing parameter selection converged after 6 iterations.
## The RMS GCV score gradient at convergence was 1.51097e-06 .
## The Hessian was positive definite.
## Model rank =  10 / 10 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##           k'  edf k-index p-value
## s(year) 9.00 1.26    1.01    0.34
gam.check(mod14.a)

## 
## Method: GCV   Optimizer: magic
## Smoothing parameter selection converged after 4 iterations.
## The RMS GCV score gradient at convergence was 2.394827e-06 .
## The Hessian was positive definite.
## Model rank =  10 / 10 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##         k'  edf k-index p-value
## s(bt) 9.00 3.58    1.53    0.99
## Blue Fish
### GLM
dc_spring_b.f <- filter(dc_spring, svspp == 'Blue.Fish')
b.f_plot <- ggplot(data = dc_spring_b.f, aes(x = year, y = cb)) +
  geom_point(color = "black", size = 1) +
  ecodata::geom_gls() +
  theme_bw() +
  theme(plot.title = element_text(size = 13)) +
  xlab("Year") +
  ylab("Consumption:Biomass") +
  scale_x_continuous(expand = expansion(mult = c(0.02, 0.02))) +
  scale_y_continuous(expand = expansion(mult = c(0.02, 0.02))) +
  theme(axis.text.x=element_text(size=10), 
        axis.text.y = element_text(size=10),
        axis.title.y=element_text(size = 10),
        axis.title.x=element_text(size = 10)) +
  ggtitle("Blue Fish")
b.f_plot

### GAM
dc_spring_b.f <- filter(dc_spring, svspp == 'Blue.Fish')
dc_spring_b.f$z_bt <- (dc_spring_b.f$bt - mean(dc_spring_b.f$bt))/(dc_spring_b.f$bt_sd)
mod15 <- gam(cb ~ s(year) + s(bt), data=dc_spring_b.f, family = 'gaussian')
summary(mod15)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## cb ~ s(year) + s(bt)
## 
## Parametric coefficients:
##             Estimate Std. Error t value Pr(>|t|)
## (Intercept) 0.007104   0.007321    0.97     0.34
## 
## Approximate significance of smooth terms:
##         edf Ref.df     F p-value
## s(year)   1      1 0.136   0.715
## s(bt)     1      1 0.052   0.822
## 
## R-sq.(adj) =  -0.0618   Deviance explained = 0.669%
## GCV = 0.0018924  Scale est. = 0.0017149  n = 32
mod15$aic
## [1] -108.126
plot(mod15, pages=1, scheme=1, unconditional=TRUE, main = "Blue Fish")
## Warning in plot.gam(mod15, pages = 1, scheme = 1, unconditional = TRUE, :
## Smoothness uncertainty corrected covariance not available

gam.check(mod15)

## 
## Method: GCV   Optimizer: magic
## Smoothing parameter selection converged after 10 iterations.
## The RMS GCV score gradient at convergence was 1.13215e-07 .
## The Hessian was positive definite.
## Model rank =  19 / 19 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##         k' edf k-index p-value
## s(year)  9   1    1.08    0.80
## s(bt)    9   1    1.06    0.43
## Longhorn Sculpin
### GLM
dc_spring_l.s <- filter(dc_spring, svspp == 'Longhorn.Sculpin')
l.s_plot <- ggplot(data = dc_spring_l.s, aes(x = year, y = cb)) +
  geom_point(color = "black", size = 1) +
  ecodata::geom_gls() +
  theme_bw() +
  theme(plot.title = element_text(size = 13)) +
  xlab("Year") +
  ylab("Consumption:Biomass") +
  scale_x_continuous(expand = expansion(mult = c(0.02, 0.02))) +
  scale_y_continuous(expand = expansion(mult = c(0.02, 0.02))) +
  theme(axis.text.x=element_text(size=10), 
        axis.text.y = element_text(size=10),
        axis.title.y=element_text(size = 10),
        axis.title.x=element_text(size = 10)) +
  ggtitle("Longhorn Sculpin")
l.s_plot

### GAM
dc_spring_l.s <- filter(dc_spring, svspp == 'Longhorn.Sculpin')
dc_spring_l.s$z_bt <- (dc_spring_l.s$bt - mean(dc_spring_l.s$bt))/(dc_spring_l.s$bt_sd)
mod16 <- gam(cb ~ s(year) + s(z_bt), data=dc_spring_l.s, family = 'gaussian')
summary(mod16)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## cb ~ s(year) + s(z_bt)
## 
## Parametric coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  0.55097    0.04207    13.1   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##           edf Ref.df      F  p-value    
## s(year) 1.230  1.425 24.466 1.69e-05 ***
## s(z_bt) 1.594  1.989  0.606    0.531    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.415   Deviance explained = 45.2%
## GCV = 0.08879  Scale est. = 0.081408  n = 46
mod16$aic
## [1] 20.81721
plot(mod16, pages=1, scheme=1, unconditional=TRUE, main = "Longhorn Sculpin")
## Warning in plot.gam(mod16, pages = 1, scheme = 1, unconditional = TRUE, :
## Smoothness uncertainty corrected covariance not available

gam.check(mod16)

## 
## Method: GCV   Optimizer: magic
## Smoothing parameter selection converged after 7 iterations.
## The RMS GCV score gradient at convergence was 1.804805e-07 .
## The Hessian was positive definite.
## Model rank =  19 / 19 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##           k'  edf k-index p-value
## s(year) 9.00 1.23    0.99    0.42
## s(z_bt) 9.00 1.59    1.14    0.84
## Striped Searobin
### GLM
dc_spring_s.s <- filter(dc_spring, svspp == 'Striped.Searobin')
s.s_plot <- ggplot(data = dc_spring_s.s, aes(x = year, y = cb)) +
  geom_point(color = "black", size = 1) +
  ecodata::geom_gls() +
  theme_bw() +
  theme(plot.title = element_text(size = 13)) +
  xlab("Year") +
  ylab("Consumption:Biomass") +
  scale_x_continuous(expand = expansion(mult = c(0.02, 0.02))) +
  scale_y_continuous(expand = expansion(mult = c(0.02, 0.02))) +
  theme(axis.text.x=element_text(size=10), 
        axis.text.y = element_text(size=10),
        axis.title.y=element_text(size = 10),
        axis.title.x=element_text(size = 10)) +
  ggtitle("Striped Searobin")
s.s_plot

### GAM
dc_spring_s.s <- filter(dc_spring, svspp == 'Striped.Searobin')
dc_spring_s.s$z_bt <- (dc_spring_s.s$bt - mean(dc_spring_s.s$bt))/(dc_spring_s.s$bt_sd)
mod17 <- gam(cb ~ s(year), data=dc_spring_s.s, family = 'gaussian')
mod17.a <- gam(cb ~ s(z_bt), data=dc_spring_s.s, family = 'gaussian')
summary(mod17)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## cb ~ s(year)
## 
## Parametric coefficients:
##             Estimate Std. Error t value Pr(>|t|)
## (Intercept)  0.04502    0.02581   1.745      0.1
## 
## Approximate significance of smooth terms:
##         edf Ref.df     F p-value
## s(year)   1      1 0.035   0.853
## 
## R-sq.(adj) =  -0.0602   Deviance explained = 0.221%
## GCV = 0.013486  Scale est. = 0.011987  n = 18
summary(mod17.a)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## cb ~ s(z_bt)
## 
## Parametric coefficients:
##             Estimate Std. Error t value Pr(>|t|)  
## (Intercept)  0.04502    0.02575   1.749   0.0995 .
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##         edf Ref.df    F p-value
## s(z_bt)   1      1 0.11   0.745
## 
## R-sq.(adj) =  -0.0553   Deviance explained = 0.68%
## GCV = 0.013424  Scale est. = 0.011932  n = 18
mod17$aic
## [1] -24.66844
mod17.a$aic
## [1] -24.75151
plot(mod17, pages=1, scheme=1, unconditional=TRUE, main = "Striped Searobin")
## Warning in plot.gam(mod17, pages = 1, scheme = 1, unconditional = TRUE, :
## Smoothness uncertainty corrected covariance not available

plot(mod17.a, pages=1, scheme=1, unconditional=TRUE, main = "Striped Searobin")
## Warning in plot.gam(mod17.a, pages = 1, scheme = 1, unconditional = TRUE, :
## Smoothness uncertainty corrected covariance not available

gam.check(mod17)

## 
## Method: GCV   Optimizer: magic
## Smoothing parameter selection converged after 10 iterations.
## The RMS GCV score gradient at convergence was 8.748969e-08 .
## The Hessian was positive definite.
## Model rank =  10 / 10 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##         k' edf k-index p-value
## s(year)  9   1    1.17    0.58
gam.check(mod17.a)

## 
## Method: GCV   Optimizer: magic
## Smoothing parameter selection converged after 12 iterations.
## The RMS GCV score gradient at convergence was 1.388623e-07 .
## The Hessian was positive definite.
## Model rank =  10 / 10 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##         k' edf k-index p-value
## s(z_bt)  9   1    1.12    0.49

Combining all of the GLMs produced above into one plot for comparison purposes:

glm_cb <- ggarrange(s.d_plot, w.s_plot, p_plot, w.h_plot, r.h_plot, g_plot, t.s_plot, a.c_plot, s.r_plot, s.h_plot,
s.f_plot, f.f_plot, w_plot, b.d_plot, b.f_plot, l.s_plot, s.s_plot, ncol = 4, nrow = 5)
glm_cb

Comparing GAMs side by side for all species of trends in consumption:biomass ratios: (For this, I broke the analysis up between looking at trends in c:b over time, and then trends in c:b in relation to bottom temperature for the purpose of allowing for a direct comparison between study species. Additionally, I did this to allow us to hone in on just how c:b is changing over time if we decide that including bottom temperature in the model is not appropriate).

# GAM of year v. cb --> I save each of these figures (total of 2 figures) once the matrix of 3x3 is filled in order to have two large figures that I can compare all species with
par(mfrow=c(3,3))
mod1 <- gam(cb ~ s(year), data=dc_spring_s.d, family = 'gaussian')
plot(mod1, scheme=1, unconditional=TRUE, main = "Spiny Dogfish") 
## Warning in plot.gam(mod1, scheme = 1, unconditional = TRUE, main = "Spiny
## Dogfish"): Smoothness uncertainty corrected covariance not available
mod2 <- gam(cb ~ s(year), data=dc_spring_w.s, family = 'gaussian')
plot(mod2, scheme=1, unconditional=TRUE, main = "Winter Skate") 
## Warning in plot.gam(mod2, scheme = 1, unconditional = TRUE, main = "Winter
## Skate"): Smoothness uncertainty corrected covariance not available
mod3 <- gam(cb ~ s(year), data=dc_spring_p, family = 'gaussian')
plot(mod3, scheme=1, unconditional=TRUE, main = "Pollock") 
## Warning in plot.gam(mod3, scheme = 1, unconditional = TRUE, main = "Pollock"):
## Smoothness uncertainty corrected covariance not available
mod4 <- gam(cb ~ s(year), data=dc_spring_w.h, family = 'gaussian')
plot(mod4, scheme=1, unconditional=TRUE, main = "White Hake")
## Warning in plot.gam(mod4, scheme = 1, unconditional = TRUE, main = "White
## Hake"): Smoothness uncertainty corrected covariance not available
mod5 <- gam(cb ~ s(year), data=dc_spring_r.h, family = 'gaussian')
plot(mod5, scheme=1, unconditional=TRUE, main = "Red Hake")
## Warning in plot.gam(mod5, scheme = 1, unconditional = TRUE, main = "Red Hake"):
## Smoothness uncertainty corrected covariance not available
mod6 <- gam(cb ~ s(year), data=dc_spring_g, family = 'gaussian')
plot(mod6, scheme=1, unconditional=TRUE, main = "Goosefish")
## Warning in plot.gam(mod6, scheme = 1, unconditional = TRUE, main = "Goosefish"):
## Smoothness uncertainty corrected covariance not available
mod7 <- gam(cb ~ s(year), data=dc_spring_t.s, family = 'gaussian')
plot(mod7, scheme=1, unconditional=TRUE, main = "Thorny Skate")
## Warning in plot.gam(mod7, scheme = 1, unconditional = TRUE, main = "Thorny
## Skate"): Smoothness uncertainty corrected covariance not available
mod8 <- gam(cb ~ s(year), data=dc_spring_a.c, family = 'gaussian')
plot(mod8, scheme=1, unconditional=TRUE, main = "Atlantic Cod")
## Warning in plot.gam(mod8, scheme = 1, unconditional = TRUE, main = "Atlantic
## Cod"): Smoothness uncertainty corrected covariance not available
mod9 <- gam(cb ~ s(year), data=dc_spring_s.r, family = 'gaussian')
plot(mod9, scheme=1, unconditional=TRUE, main = "Sea Raven")
## Warning in plot.gam(mod9, scheme = 1, unconditional = TRUE, main = "Sea Raven"):
## Smoothness uncertainty corrected covariance not available

mod10 <- gam(cb ~ s(year), data=dc_spring_s.h, family = 'gaussian')
plot(mod10, scheme=1, unconditional=TRUE, main = "Silver Hake")
## Warning in plot.gam(mod10, scheme = 1, unconditional = TRUE, main = "Silver
## Hake"): Smoothness uncertainty corrected covariance not available
mod11 <- gam(cb ~ s(year), data=dc_spring_s.f, family = 'gaussian')
plot(mod11, scheme=1, unconditional=TRUE, main = "Summer Flounder")
## Warning in plot.gam(mod11, scheme = 1, unconditional = TRUE, main = "Summer
## Flounder"): Smoothness uncertainty corrected covariance not available
mod12 <- gam(cb ~ s(year), data=dc_spring_f.f, family = 'gaussian')
plot(mod12, scheme=1, unconditional=TRUE, main = "Fourspot Flounder")
## Warning in plot.gam(mod12, scheme = 1, unconditional = TRUE, main = "Fourspot
## Flounder"): Smoothness uncertainty corrected covariance not available
mod13 <- gam(cb ~ s(year), data=dc_spring_w, family = 'gaussian')
plot(mod13, scheme=1, unconditional=TRUE, main = "Windowpane")
## Warning in plot.gam(mod13, scheme = 1, unconditional = TRUE, main =
## "Windowpane"): Smoothness uncertainty corrected covariance not available
mod14 <- gam(cb ~ s(year), data=dc_spring_b.d, family = 'gaussian')
plot(mod14, scheme=1, unconditional=TRUE, main = "Buckler Dory")
## Warning in plot.gam(mod14, scheme = 1, unconditional = TRUE, main = "Buckler
## Dory"): Smoothness uncertainty corrected covariance not available
mod15 <- gam(cb ~ s(year), data=dc_spring_b.f, family = 'gaussian')
plot(mod15, scheme=1, unconditional=TRUE, main = "Blue Fish")
## Warning in plot.gam(mod15, scheme = 1, unconditional = TRUE, main = "Blue
## Fish"): Smoothness uncertainty corrected covariance not available
mod16 <- gam(cb ~ s(year), data=dc_spring_l.s, family = 'gaussian')
plot(mod16, scheme=1, unconditional=TRUE, main = "Longhorn Sculpin")
## Warning in plot.gam(mod16, scheme = 1, unconditional = TRUE, main = "Longhorn
## Sculpin"): Smoothness uncertainty corrected covariance not available
mod17 <- gam(cb ~ s(year), data=dc_spring_s.s, family = 'gaussian')
plot(mod17, scheme = 1, unconditional=TRUE, main = "Striped Searobin")
## Warning in plot.gam(mod17, scheme = 1, unconditional = TRUE, main = "Striped
## Searobin"): Smoothness uncertainty corrected covariance not available
# GAM of bt v. cb --> same note as above
par(mfrow = c(3,3))

mod1 <- gam(cb ~ s(bt), data=dc_spring_s.d, family = 'gaussian')
plot(mod1, scheme=1, unconditional=TRUE, main = "Spiny Dogfish")
## Warning in plot.gam(mod1, scheme = 1, unconditional = TRUE, main = "Spiny
## Dogfish"): Smoothness uncertainty corrected covariance not available
mod2 <- gam(cb ~ s(bt), data=dc_spring_w.s, family = 'gaussian')
plot(mod2, scheme=1, unconditional=TRUE, main = "Winter Skate")
## Warning in plot.gam(mod2, scheme = 1, unconditional = TRUE, main = "Winter
## Skate"): Smoothness uncertainty corrected covariance not available
mod3 <- gam(cb ~ s(bt), data=dc_spring_p, family = 'gaussian')
plot(mod3, scheme=1, unconditional=TRUE, main = "Pollock")
## Warning in plot.gam(mod3, scheme = 1, unconditional = TRUE, main = "Pollock"):
## Smoothness uncertainty corrected covariance not available
mod4 <- gam(cb ~ s(bt), data=dc_spring_w.h, family = 'gaussian')
plot(mod4, scheme=1, unconditional=TRUE, main = "White Hake")
## Warning in plot.gam(mod4, scheme = 1, unconditional = TRUE, main = "White
## Hake"): Smoothness uncertainty corrected covariance not available
mod5 <- gam(cb ~ s(bt), data=dc_spring_r.h, family = 'gaussian')
plot(mod5, scheme=1, unconditional=TRUE, main = " Red Hake")
## Warning in plot.gam(mod5, scheme = 1, unconditional = TRUE, main = " Red Hake"):
## Smoothness uncertainty corrected covariance not available
mod6 <- gam(cb ~ s(bt), data=dc_spring_g, family = 'gaussian')
plot(mod6, scheme=1, unconditional=TRUE, main = "Goosefish")
## Warning in plot.gam(mod6, scheme = 1, unconditional = TRUE, main = "Goosefish"):
## Smoothness uncertainty corrected covariance not available
mod7 <- gam(cb ~ s(bt), data=dc_spring_t.s, family = 'gaussian')
plot(mod7, scheme=1, unconditional=TRUE, main = "Thorny Skate")
## Warning in plot.gam(mod7, scheme = 1, unconditional = TRUE, main = "Thorny
## Skate"): Smoothness uncertainty corrected covariance not available
mod8 <- gam(cb ~ s(bt), data=dc_spring_a.c, family = 'gaussian')
plot(mod8, scheme=1, unconditional=TRUE, main = "Atlantic Cod")
## Warning in plot.gam(mod8, scheme = 1, unconditional = TRUE, main = "Atlantic
## Cod"): Smoothness uncertainty corrected covariance not available
mod9 <- gam(cb ~ s(bt), data=dc_spring_s.r, family = 'gaussian')
plot(mod9, scheme=1, unconditional=TRUE, main = "Sea Raven")
## Warning in plot.gam(mod9, scheme = 1, unconditional = TRUE, main = "Sea Raven"):
## Smoothness uncertainty corrected covariance not available

mod10 <- gam(cb ~ s(bt), data=dc_spring_s.h, family = 'gaussian')
plot(mod10, scheme=1, unconditional=TRUE, main = "Silver Hake")
## Warning in plot.gam(mod10, scheme = 1, unconditional = TRUE, main = "Silver
## Hake"): Smoothness uncertainty corrected covariance not available
mod11 <- gam(cb ~ s(bt), data=dc_spring_s.f, family = 'gaussian')
plot(mod11, scheme=1, unconditional=TRUE, main = "Summer Flounder")
## Warning in plot.gam(mod11, scheme = 1, unconditional = TRUE, main = "Summer
## Flounder"): Smoothness uncertainty corrected covariance not available
mod12 <- gam(cb ~ s(bt), data=dc_spring_f.f, family = 'gaussian')
plot(mod12, scheme=1, unconditional=TRUE, main = "Fourspot Flounder")
## Warning in plot.gam(mod12, scheme = 1, unconditional = TRUE, main = "Fourspot
## Flounder"): Smoothness uncertainty corrected covariance not available
mod13 <- gam(cb ~ s(bt), data=dc_spring_w, family = 'gaussian')
plot(mod13, scheme=1, unconditional=TRUE, main = "Windowpane")
## Warning in plot.gam(mod13, scheme = 1, unconditional = TRUE, main =
## "Windowpane"): Smoothness uncertainty corrected covariance not available
mod14 <- gam(cb ~ s(bt) , data=dc_spring_b.d, family = 'gaussian')
plot(mod14, scheme=1, unconditional=TRUE, main = "Buckler Dory")
## Warning in plot.gam(mod14, scheme = 1, unconditional = TRUE, main = "Buckler
## Dory"): Smoothness uncertainty corrected covariance not available
mod15 <- gam(cb ~ s(bt), data=dc_spring_b.f, family = 'gaussian')
plot(mod15, scheme=1, unconditional=TRUE, main = "Blue Fish")
## Warning in plot.gam(mod15, scheme = 1, unconditional = TRUE, main = "Blue
## Fish"): Smoothness uncertainty corrected covariance not available
mod16 <- gam(cb ~ s(z_bt), data=dc_spring_l.s, family = 'gaussian')
plot(mod16, scheme=1, unconditional=TRUE, main = "Longhorn Sculpin")
## Warning in plot.gam(mod16, scheme = 1, unconditional = TRUE, main = "Longhorn
## Sculpin"): Smoothness uncertainty corrected covariance not available
mod17 <- gam(cb ~ s(z_bt), data=dc_spring_s.s, family = 'gaussian')
plot(mod17, scheme = 1, unconditional=TRUE, main = "Striped Searobin")
## Warning in plot.gam(mod17, scheme = 1, unconditional = TRUE, main = "Striped
## Searobin"): Smoothness uncertainty corrected covariance not available

Filtering the dataset to focus only on fall samples:

dc_fall <- filter(data_comb_f, seacat == 'FALL')

Building GLMs and GAMs for study species across all prey types for fall:

## Spiny Dogfish
### GLM
dc_fall_s.d <- filter(dc_fall, svspp == 'Spiny.Dogfish')
s.d_plot_f <- ggplot(data = dc_fall_s.d, aes(x = year, y = cb)) +
  geom_point(color = "black", size = 1) +
  ecodata::geom_gls() +
  theme_bw() +
  theme(plot.title = element_text(size = 13)) +
  xlab("Year") +
  ylab("Consumption:Biomass") +
  scale_x_continuous(expand = expansion(mult = c(0.02, 0.02))) +
  scale_y_continuous(expand = expansion(mult = c(0.02, 0.02))) +
  theme(axis.text.x=element_text(size=10), 
        axis.text.y = element_text(size=10),
        axis.title.y=element_text(size = 10),
        axis.title.x=element_text(size = 10)) +
  ggtitle("Spiny Dogfish")
s.d_plot_f

### GAM
dc_fall_s.d <- filter(dc_fall, svspp == 'Spiny.Dogfish')
dc_fall_s.d$z_bt <- (dc_fall_s.d$bt - mean(dc_fall_s.d$bt))/(dc_fall_s.d$bt_sd)
mod18 <- gam(cb ~ s(year) + s(bt), data=dc_fall_s.d, family = 'gaussian')
summary(mod18)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## cb ~ s(year) + s(bt)
## 
## Parametric coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)    0.430      0.055   7.818 3.86e-09 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##           edf Ref.df     F p-value  
## s(year) 7.547  8.467 2.871  0.0172 *
## s(bt)   1.000  1.000 1.921  0.1748  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =   0.34   Deviance explained = 47.1%
## GCV = 0.17001  Scale est. = 0.13312   n = 44
mod18$aic
## [1] 46.47349
plot(mod18, pages=1, scheme=1, unconditional=TRUE, main = "Spiny Dogfish")
## Warning in plot.gam(mod18, pages = 1, scheme = 1, unconditional = TRUE, :
## Smoothness uncertainty corrected covariance not available

gam.check(mod18)

## 
## Method: GCV   Optimizer: magic
## Smoothing parameter selection converged after 17 iterations.
## The RMS GCV score gradient at convergence was 1.041789e-07 .
## The Hessian was positive definite.
## Model rank =  19 / 19 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##           k'  edf k-index p-value  
## s(year) 9.00 7.55    1.08   0.690  
## s(bt)   9.00 1.00    0.74   0.025 *
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## Winter Skate
### GLM
dc_fall_w.s <- filter(dc_fall, svspp == 'Winter.Skate')
w.s_plot_f <- ggplot(data = dc_fall_w.s, aes(x = year, y = cb)) +
  geom_point(color = "black", size = 1) +
  ecodata::geom_gls() +
  theme_bw() +
  theme(plot.title = element_text(size = 13)) +
  xlab("Year") +
  ylab("Consumption:Biomass") +
  scale_x_continuous(expand = expansion(mult = c(0.02, 0.02))) +
  scale_y_continuous(expand = expansion(mult = c(0.02, 0.02))) +
  theme(axis.text.x=element_text(size=10), 
        axis.text.y = element_text(size=10),
        axis.title.y=element_text(size = 10),
        axis.title.x=element_text(size = 10)) +
  ggtitle("Winter Skate")
w.s_plot_f

### GAM
dc_fall_w.s <- filter(dc_fall, svspp == 'Winter.Skate')
dc_fall_w.s$z_bt <- (dc_fall_w.s$bt - mean(dc_fall_w.s$bt))/(dc_fall_w.s$bt_sd)
mod19 <- gam(cb ~ s(year) + s(z_bt), data=dc_fall_w.s, family = 'gaussian')
summary(mod19)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## cb ~ s(year) + s(z_bt)
## 
## Parametric coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  0.37136    0.04394   8.451  1.7e-10 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##           edf Ref.df     F p-value
## s(year) 1.222  1.410 2.468   0.148
## s(z_bt) 2.083  2.632 2.039   0.105
## 
## R-sq.(adj) =  0.187   Deviance explained = 24.8%
## GCV = 0.096087  Scale est. = 0.086893  n = 45
mod19$aic
## [1] 23.85156
plot(mod19, pages=1, scheme=1, unconditional=TRUE, main = "Winter Skate")
## Warning in plot.gam(mod19, pages = 1, scheme = 1, unconditional = TRUE, :
## Smoothness uncertainty corrected covariance not available

gam.check(mod19)

## 
## Method: GCV   Optimizer: magic
## Smoothing parameter selection converged after 15 iterations.
## The RMS GCV score gradient at convergence was 6.180394e-07 .
## The Hessian was positive definite.
## Model rank =  19 / 19 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##           k'  edf k-index p-value
## s(year) 9.00 1.22    0.96    0.28
## s(z_bt) 9.00 2.08    0.85    0.10
## Pollock
### GLM 
dc_fall_p <- filter(dc_fall, svspp == 'Pollock')
p_plot_f <- ggplot(data = dc_fall_p, aes(x = year, y = cb)) +
  geom_point(color = "black", size = 1) +
  ecodata::geom_gls() +
  theme_bw() +
  theme(plot.title = element_text(size = 13)) +
  xlab("Year") +
  ylab("Consumption:Biomass") +
  scale_x_continuous(expand = expansion(mult = c(0.02, 0.02))) +
  scale_y_continuous(expand = expansion(mult = c(0.02, 0.02))) +
  theme(axis.text.x=element_text(size=10), 
        axis.text.y = element_text(size=10),
        axis.title.y=element_text(size = 10),
        axis.title.x=element_text(size = 10)) +
  ggtitle("Pollock")
p_plot_f

### GAM
dc_fall_p <- filter(dc_fall, svspp == 'Pollock')
dc_fall_p$z_bt <- (dc_fall_p$bt - mean(dc_fall_p$bt))/(dc_fall_p$bt_sd)
mod20 <- gam(cb ~ s(year) + s(bt), data=dc_fall_p, family = 'gaussian')
summary(mod20)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## cb ~ s(year) + s(bt)
## 
## Parametric coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  0.34983    0.06578   5.318 3.75e-06 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##           edf Ref.df     F p-value  
## s(year) 2.941   3.68 3.239  0.0221 *
## s(bt)   1.000   1.00 2.137  0.1513  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.192   Deviance explained = 26.2%
## GCV = 0.22725  Scale est. = 0.20336   n = 47
mod20$aic
## [1] 65.18195
plot(mod20, pages=1, scheme=1, unconditional=TRUE, main = "Pollock")
## Warning in plot.gam(mod20, pages = 1, scheme = 1, unconditional = TRUE, :
## Smoothness uncertainty corrected covariance not available

gam.check(mod20)

## 
## Method: GCV   Optimizer: magic
## Smoothing parameter selection converged after 12 iterations.
## The RMS GCV score gradient at convergence was 8.345769e-08 .
## The Hessian was positive definite.
## Model rank =  19 / 19 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##           k'  edf k-index p-value
## s(year) 9.00 2.94    0.86    0.14
## s(bt)   9.00 1.00    1.14    0.85
## White Hake
### GLM
dc_fall_w.h <- filter(dc_fall, svspp == 'White.Hake')
w.h_plot_f <- ggplot(data = dc_fall_w.h, aes(x = year, y = cb)) +
  geom_point(color = "black", size = 1) +
  ecodata::geom_gls() +
  theme_bw() +
  theme(plot.title = element_text(size = 13)) +
  xlab("Year") +
  ylab("Consumption:Biomass") +
  scale_x_continuous(expand = expansion(mult = c(0.02, 0.02))) +
  scale_y_continuous(expand = expansion(mult = c(0.02, 0.02))) +
  theme(axis.text.x=element_text(size=10), 
        axis.text.y = element_text(size=10),
        axis.title.y=element_text(size = 10),
        axis.title.x=element_text(size = 10)) +
  ggtitle("White Hake")
w.h_plot_f

### GAM
dc_fall_w.h <- filter(dc_fall, svspp == 'White.Hake')
dc_fall_w.h$z_bt <- (dc_fall_w.h$bt - mean(dc_fall_w.h$bt))/(dc_fall_w.h$bt_sd)
mod21 <- gam(cb ~ s(year) + s(z_bt), data=dc_fall_w.h, family = 'gaussian')
summary(mod21)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## cb ~ s(year) + s(z_bt)
## 
## Parametric coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  0.85838    0.06975   12.31 5.31e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##         edf Ref.df     F p-value  
## s(year)   1      1 6.207  0.0165 *
## s(z_bt)   1      1 0.011  0.9178  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.0944   Deviance explained = 13.3%
## GCV = 0.24906  Scale est. = 0.23349   n = 48
mod21$aic
## [1] 71.29863
plot(mod21, pages=1, scheme=1, unconditional=TRUE, main = "White Hake")
## Warning in plot.gam(mod21, pages = 1, scheme = 1, unconditional = TRUE, :
## Smoothness uncertainty corrected covariance not available

gam.check(mod21)

## 
## Method: GCV   Optimizer: magic
## Smoothing parameter selection converged after 12 iterations.
## The RMS GCV score gradient at convergence was 9.798492e-08 .
## The Hessian was positive definite.
## Model rank =  19 / 19 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##         k' edf k-index p-value
## s(year)  9   1    1.01    0.47
## s(z_bt)  9   1    1.07    0.57
## Red Hake
### GLM
dc_fall_r.h <- filter(dc_fall, svspp == 'Red.Hake')
r.h_plot_f <- ggplot(data = dc_fall_r.h, aes(x = year, y = cb)) +
  geom_point(color = "black", size = 1) +
  ecodata::geom_gls() +
  theme_bw() +
  theme(plot.title = element_text(size = 13)) +
  xlab("Year") +
  ylab("Consumption:Biomass") +
  scale_x_continuous(expand = expansion(mult = c(0.02, 0.02))) +
  scale_y_continuous(expand = expansion(mult = c(0.02, 0.02))) +
  theme(axis.text.x=element_text(size=10), 
        axis.text.y = element_text(size=10),
        axis.title.y=element_text(size = 10),
        axis.title.x=element_text(size = 10)) +
  ggtitle("Red Hake")
r.h_plot_f

### GAM
dc_fall_r.h <- filter(dc_fall, svspp == 'Red.Hake')
dc_fall_r.h$z_bt <- (dc_fall_r.h$bt - mean(dc_fall_r.h$bt))/(dc_fall_r.h$bt_sd)
mod22 <- gam(cb ~ s(year) + s(bt), data=dc_fall_r.h, family = 'gaussian')
summary(mod22)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## cb ~ s(year) + s(bt)
## 
## Parametric coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)   1.0205     0.1039   9.821 2.06e-12 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##           edf Ref.df     F p-value
## s(year) 1.579  1.968 0.794   0.481
## s(bt)   3.703  4.639 1.544   0.206
## 
## R-sq.(adj) =  0.179   Deviance explained = 27.1%
## GCV = 0.59623  Scale est. = 0.5182    n = 48
mod22$aic
## [1] 112.4941
plot(mod22, pages=1, scheme=1, unconditional=TRUE, main = "Red Hake")
## Warning in plot.gam(mod22, pages = 1, scheme = 1, unconditional = TRUE, :
## Smoothness uncertainty corrected covariance not available

gam.check(mod22)

## 
## Method: GCV   Optimizer: magic
## Smoothing parameter selection converged after 27 iterations.
## The RMS GCV score gradient at convergence was 1.692964e-06 .
## The Hessian was positive definite.
## Model rank =  19 / 19 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##           k'  edf k-index p-value
## s(year) 9.00 1.58    1.20     0.9
## s(bt)   9.00 3.70    1.18     0.9
## Goosefish
### GLM
dc_fall_g <- filter(dc_fall, svspp == 'Goosefish')
g_plot_f <- ggplot(data = dc_fall_g, aes(x = year, y = cb)) +
  geom_point(color = "black", size = 1) +
  ecodata::geom_gls() +
  theme_bw() +
  theme(plot.title = element_text(size = 13)) +
  xlab("Year") +
  ylab("Consumption:Biomass") +
  scale_x_continuous(expand = expansion(mult = c(0.02, 0.02))) +
  scale_y_continuous(expand = expansion(mult = c(0.02, 0.02))) +
  theme(axis.text.x=element_text(size=10), 
        axis.text.y = element_text(size=10),
        axis.title.y=element_text(size = 10),
        axis.title.x=element_text(size = 10)) +
  ggtitle("Goosefish")
g_plot_f

### GAM
dc_fall_g <- filter(dc_fall, svspp == 'Goosefish')
dc_fall_g$z_bt <- (dc_fall_g$bt - mean(dc_fall_g$bt))/(dc_fall_g$bt_sd)
mod23 <- gam(cb ~ s(year) + s(z_bt), data=dc_fall_g, family = 'gaussian')
summary(mod23)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## cb ~ s(year) + s(z_bt)
## 
## Parametric coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)   1.4648     0.1111   13.18 5.47e-14 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##           edf Ref.df     F p-value
## s(year) 6.559  7.619 1.782   0.146
## s(z_bt) 6.555  7.589 1.955   0.103
## 
## R-sq.(adj) =  0.479   Deviance explained = 63.8%
## GCV = 0.79972  Scale est. = 0.54319   n = 44
mod23$aic
## [1] 111.2226
plot(mod23, pages=1, scheme=1, unconditional=TRUE, main = "Goosefish")
## Warning in plot.gam(mod23, pages = 1, scheme = 1, unconditional = TRUE, :
## Smoothness uncertainty corrected covariance not available

gam.check(mod23)

## 
## Method: GCV   Optimizer: magic
## Smoothing parameter selection converged after 10 iterations.
## The RMS GCV score gradient at convergence was 4.770115e-05 .
## The Hessian was positive definite.
## Model rank =  19 / 19 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##           k'  edf k-index p-value
## s(year) 9.00 6.56    1.05    0.61
## s(z_bt) 9.00 6.55    1.30    0.98
## Thorny Skate
### GLM
dc_fall_t.s <- filter(dc_fall, svspp == 'Thorny.Skate')
t.s_plot_f <- ggplot(data = dc_fall_t.s, aes(x = year, y = cb)) +
  geom_point(color = "black", size = 1) +
  ecodata::geom_gls() +
  theme_bw() +
  theme(plot.title = element_text(size = 13)) +
  xlab("Year") +
  ylab("Consumption:Biomass") +
  scale_x_continuous(expand = expansion(mult = c(0.02, 0.02))) +
  scale_y_continuous(expand = expansion(mult = c(0.02, 0.02))) +
  theme(axis.text.x=element_text(size=10), 
        axis.text.y = element_text(size=10),
        axis.title.y=element_text(size = 10),
        axis.title.x=element_text(size = 10)) +
  ggtitle("Thorny Skate")
t.s_plot_f

### GAM
dc_fall_t.s <- filter(dc_fall, svspp == 'Thorny.Skate')
dc_fall_t.s$z_bt <- (dc_fall_t.s$bt - mean(dc_fall_t.s$bt))/(dc_fall_t.s$bt_sd)
mod24 <- gam(cb ~ s(year) + s(bt), data=dc_fall_t.s, family = 'gaussian')
summary(mod24)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## cb ~ s(year) + s(bt)
## 
## Parametric coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  0.25542    0.02414   10.58 2.03e-12 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##           edf Ref.df     F p-value
## s(year) 3.991  4.901 2.006   0.115
## s(bt)   1.204  1.375 0.149   0.884
## 
## R-sq.(adj) =  0.159   Deviance explained = 26.8%
## GCV = 0.028143  Scale est. = 0.02389   n = 41
mod24$aic
## [1] -29.07856
plot(mod24, pages=1, scheme=1, unconditional=TRUE, main = "Thorny Skate")
## Warning in plot.gam(mod24, pages = 1, scheme = 1, unconditional = TRUE, :
## Smoothness uncertainty corrected covariance not available

gam.check(mod24)

## 
## Method: GCV   Optimizer: magic
## Smoothing parameter selection converged after 9 iterations.
## The RMS GCV score gradient at convergence was 8.809478e-07 .
## The Hessian was positive definite.
## Model rank =  19 / 19 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##           k'  edf k-index p-value
## s(year) 9.00 3.99     1.3    0.95
## s(bt)   9.00 1.20     1.1    0.70
## Atlantic Cod
### GLM
dc_fall_a.c <- filter(dc_fall, svspp == 'Atlantic.Cod')
a.c_plot_f <- ggplot(data = dc_fall_a.c, aes(x = year, y = cb)) +
  geom_point(color = "black", size = 1) +
  ecodata::geom_gls() +
  theme_bw() +
  theme(plot.title = element_text(size = 13)) +
  xlab("Year") +
  ylab("Consumption:Biomass") +
  scale_x_continuous(expand = expansion(mult = c(0.02, 0.02))) +
  scale_y_continuous(expand = expansion(mult = c(0.02, 0.02))) +
  theme(axis.text.x=element_text(size=10), 
        axis.text.y = element_text(size=10),
        axis.title.y=element_text(size = 10),
        axis.title.x=element_text(size = 10)) +
  ggtitle("Atlanic Cod")
a.c_plot_f

### GAM
dc_fall_a.c <- filter(dc_fall, svspp == 'Atlantic.Cod')
dc_fall_a.c$z_bt <- (dc_fall_a.c$bt - mean(dc_fall_a.c$bt))/(dc_fall_a.c$bt_sd)
mod25 <- gam(cb ~ s(year) + s(bt), data=dc_fall_a.c, family = 'gaussian')
summary(mod25)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## cb ~ s(year) + s(bt)
## 
## Parametric coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  0.50170    0.03426   14.64   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##           edf Ref.df     F p-value
## s(year) 1.585  1.979 2.123   0.160
## s(bt)   1.000  1.000 0.752   0.391
## 
## R-sq.(adj) =  0.0514   Deviance explained = 10.5%
## GCV = 0.059709  Scale est. = 0.055155  n = 47
mod25$aic
## [1] 2.633083
plot(mod25, pages=1, scheme=1, unconditional=TRUE, main = "Atlantic Cod")
## Warning in plot.gam(mod25, pages = 1, scheme = 1, unconditional = TRUE, :
## Smoothness uncertainty corrected covariance not available

gam.check(mod25)

## 
## Method: GCV   Optimizer: magic
## Smoothing parameter selection converged after 14 iterations.
## The RMS GCV score gradient at convergence was 6.263954e-08 .
## The Hessian was positive definite.
## Model rank =  19 / 19 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##           k'  edf k-index p-value
## s(year) 9.00 1.58    1.21    0.83
## s(bt)   9.00 1.00    1.05    0.57
## Sea Raven
### GLM
dc_fall_s.r <- filter(dc_fall, svspp == 'Sea.Raven')
s.r_plot_f <- ggplot(data = dc_fall_s.r, aes(x = year, y = cb)) +
  geom_point(color = "black", size = 1) +
  ecodata::geom_gls() +
  theme_bw() +
  theme(plot.title = element_text(size = 13)) +
  xlab("Year") +
  ylab("Consumption:Biomass") +
  scale_x_continuous(expand = expansion(mult = c(0.02, 0.02))) +
  scale_y_continuous(expand = expansion(mult = c(0.02, 0.02))) +
  theme(axis.text.x=element_text(size=10), 
        axis.text.y = element_text(size=10),
        axis.title.y=element_text(size = 10),
        axis.title.x=element_text(size = 10)) +
  ggtitle("Sea Raven")
s.r_plot_f

### GAM
dc_fall_s.r <- filter(dc_fall, svspp == 'Sea.Raven')
dc_fall_s.r$z_bt <- (dc_fall_s.r$bt - mean(dc_fall_s.r$bt))/(dc_fall_s.r$bt_sd)
mod26 <- gam(cb ~ s(year) + s(z_bt), data=dc_fall_s.r, family = 'gaussian')
summary(mod26)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## cb ~ s(year) + s(z_bt)
## 
## Parametric coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)   1.0002     0.1552   6.447  1.4e-07 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##           edf Ref.df     F p-value  
## s(year) 1.000  1.000 5.424  0.0253 *
## s(z_bt) 1.049  1.096 1.052  0.3349  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.0802   Deviance explained = 12.7%
## GCV = 1.0663  Scale est. = 0.98701   n = 41
mod26$aic
## [1] 120.7466
plot(mod26, pages=1, scheme=1, unconditional=TRUE, main = "Sea Raven")
## Warning in plot.gam(mod26, pages = 1, scheme = 1, unconditional = TRUE, :
## Smoothness uncertainty corrected covariance not available

gam.check(mod26)

## 
## Method: GCV   Optimizer: magic
## Smoothing parameter selection converged after 12 iterations.
## The RMS GCV score gradient at convergence was 1.747061e-07 .
## The Hessian was positive definite.
## Model rank =  19 / 19 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##           k'  edf k-index p-value
## s(year) 9.00 1.00    1.42    1.00
## s(z_bt) 9.00 1.05    1.34    0.98
## Silver Hake
### GLM
dc_fall_s.h <- filter(dc_fall, svspp == 'Silver.Hake')
s.h_plot_f <- ggplot(data = dc_fall_s.h, aes(x = year, y = cb)) +
  geom_point(color = "black", size = 1) +
  ecodata::geom_gls() +
  theme_bw() +
  theme(plot.title = element_text(size = 13)) +
  xlab("Year") +
  ylab("Consumption:Biomass") +
  scale_x_continuous(expand = expansion(mult = c(0.02, 0.02))) +
  scale_y_continuous(expand = expansion(mult = c(0.02, 0.02))) +
  theme(axis.text.x=element_text(size=10), 
        axis.text.y = element_text(size=10),
        axis.title.y=element_text(size = 10),
        axis.title.x=element_text(size = 10)) +
  ggtitle("Silver Hake")
s.h_plot_f

### GAM
dc_fall_s.h <- filter(dc_fall, svspp == 'Silver.Hake')
dc_fall_s.h$z_bt <- (dc_fall_s.h$bt - mean(dc_fall_s.h$bt))/(dc_fall_s.h$bt_sd)
mod27 <- gam(cb ~ s(year) + s(z_bt), data=dc_fall_s.h, family = 'gaussian')
summary(mod27)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## cb ~ s(year) + s(z_bt)
## 
## Parametric coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)   1.5343     0.1173   13.08   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##           edf Ref.df     F p-value
## s(year) 1.000  1.000 1.285   0.263
## s(z_bt) 2.643  3.264 2.149   0.108
## 
## R-sq.(adj) =  0.103   Deviance explained = 17.2%
## GCV = 0.73148  Scale est. = 0.66072   n = 48
mod27$aic
## [1] 122.7285
plot(mod27, pages=1, scheme=1, unconditional=TRUE, main = "Silver Hake")
## Warning in plot.gam(mod27, pages = 1, scheme = 1, unconditional = TRUE, :
## Smoothness uncertainty corrected covariance not available

gam.check(mod27)

## 
## Method: GCV   Optimizer: magic
## Smoothing parameter selection converged after 11 iterations.
## The RMS GCV score gradient at convergence was 2.171858e-07 .
## The Hessian was positive definite.
## Model rank =  19 / 19 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##           k'  edf k-index p-value
## s(year) 9.00 1.00    1.31    0.96
## s(z_bt) 9.00 2.64    0.97    0.39
## Summer Flounder
### GLM
dc_fall_s.f <- filter(dc_fall, svspp == 'Summer.Flounder')
s.f_plot_f <- ggplot(data = dc_fall_s.f, aes(x = year, y = cb)) +
  geom_point(color = "black", size = 1) +
  ecodata::geom_gls() +
  theme_bw() +
  theme(plot.title = element_text(size = 13)) +
  xlab("Year") +
  ylab("Consumption:Biomass") +
  scale_x_continuous(expand = expansion(mult = c(0.02, 0.02))) +
  scale_y_continuous(expand = expansion(mult = c(0.02, 0.02))) +
  theme(axis.text.x=element_text(size=10), 
        axis.text.y = element_text(size=10),
        axis.title.y=element_text(size = 10),
        axis.title.x=element_text(size = 10)) +
  ggtitle("Summer Flounder")
s.f_plot_f

### GAM
dc_fall_s.f <- filter(dc_fall, svspp == 'Summer.Flounder')
dc_fall_s.f$z_bt <- (dc_fall_s.f$bt - mean(dc_fall_s.f$bt))/(dc_fall_s.f$bt_sd)
mod28 <- gam(cb ~ s(year) + s(bt), data=dc_fall_s.f, family = 'gaussian')
summary(mod28)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## cb ~ s(year) + s(bt)
## 
## Parametric coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  0.44691    0.03846   11.62 4.13e-13 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##           edf Ref.df     F p-value   
## s(year) 1.000  1.000 1.329 0.25751   
## s(bt)   8.509  8.926 3.167 0.00766 **
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.382   Deviance explained = 52.2%
## GCV = 0.084192  Scale est. = 0.063617  n = 43
mod28$aic
## [1] 14.53652
plot(mod28, pages=1, scheme=1, unconditional=TRUE, main = "Summer Flounder")
## Warning in plot.gam(mod28, pages = 1, scheme = 1, unconditional = TRUE, :
## Smoothness uncertainty corrected covariance not available

gam.check(mod28)

## 
## Method: GCV   Optimizer: magic
## Smoothing parameter selection converged after 12 iterations.
## The RMS GCV score gradient at convergence was 1.099816e-07 .
## The Hessian was positive definite.
## Model rank =  19 / 19 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##           k'  edf k-index p-value
## s(year) 9.00 1.00    1.16    0.86
## s(bt)   9.00 8.51    1.22    0.92
## Fourspot Flounder
### GLM
dc_fall_f.f <- filter(dc_fall, svspp == 'Fourspot.Flounder')
f.f_plot_f <- ggplot(data = dc_fall_s.f, aes(x = year, y = cb)) +
  geom_point(color = "black", size = 1) +
  ecodata::geom_gls() +
  theme_bw() +
  theme(plot.title = element_text(size = 13)) +
  xlab("Year") +
  ylab("Consumption:Biomass") +
  scale_x_continuous(expand = expansion(mult = c(0.02, 0.02))) +
  scale_y_continuous(expand = expansion(mult = c(0.02, 0.02))) +
  theme(axis.text.x=element_text(size=10), 
        axis.text.y = element_text(size=10),
        axis.title.y=element_text(size = 10),
        axis.title.x=element_text(size = 10)) +
  ggtitle("Fourspot Flounder")
f.f_plot_f

### GAM
dc_fall_f.f <- filter(dc_fall, svspp == 'Fourspot.Flounder')
dc_fall_f.f$z_bt <- (dc_fall_f.f$bt - mean(dc_fall_f.f$bt))/(dc_fall_f.f$bt_sd)
mod29 <- gam(cb ~ s(year) + s(z_bt), data=dc_fall_f.f, family = 'gaussian')
summary(mod29)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## cb ~ s(year) + s(z_bt)
## 
## Parametric coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  0.61381    0.03907   15.71   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##           edf Ref.df     F p-value  
## s(year) 4.041  4.958 2.861  0.0302 *
## s(z_bt) 5.601  6.659 1.858  0.1090  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.422   Deviance explained = 54.6%
## GCV = 0.091329  Scale est. = 0.070201  n = 46
mod29$aic
## [1] 19.52844
plot(mod29, pages=1, scheme=1, unconditional=TRUE, main = "Fourspot Flounder")
## Warning in plot.gam(mod29, pages = 1, scheme = 1, unconditional = TRUE, :
## Smoothness uncertainty corrected covariance not available

gam.check(mod29)

## 
## Method: GCV   Optimizer: magic
## Smoothing parameter selection converged after 7 iterations.
## The RMS GCV score gradient at convergence was 4.048242e-06 .
## The Hessian was positive definite.
## Model rank =  19 / 19 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##           k'  edf k-index p-value
## s(year) 9.00 4.04    1.05    0.58
## s(z_bt) 9.00 5.60    1.18    0.88
## Windowpane
### GLM
dc_fall_w <- filter(dc_fall, svspp == 'Windowpane')
w_plot_f <- ggplot(data = dc_fall_w, aes(x = year, y = cb)) +
  geom_point(color = "black", size = 1) +
  ecodata::geom_gls() +
  theme_bw() +
  theme(plot.title = element_text(size = 13)) +
  xlab("Year") +
  ylab("Consumption:Biomass") +
  scale_x_continuous(expand = expansion(mult = c(0.02, 0.02))) +
  scale_y_continuous(expand = expansion(mult = c(0.02, 0.02))) +
  theme(axis.text.x=element_text(size=10), 
        axis.text.y = element_text(size=10),
        axis.title.y=element_text(size = 10),
        axis.title.x=element_text(size = 10)) +
  ggtitle("Windowpane")
w_plot_f

### GAM
dc_fall_w <- filter(dc_fall, svspp == 'Windowpane')
dc_fall_w$z_bt <- (dc_fall_w$bt - mean(dc_fall_w$bt))/(dc_fall_w$bt_sd)
mod30 <- gam(cb ~ s(year) + s(z_bt), data=dc_fall_w, family = 'gaussian')
summary(mod30)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## cb ~ s(year) + s(z_bt)
## 
## Parametric coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)   0.7419     0.1118   6.636 1.59e-07 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##           edf Ref.df     F p-value  
## s(year) 6.709  7.827 1.875  0.0983 .
## s(z_bt) 1.692  2.117 1.699  0.2058  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.242   Deviance explained = 39.8%
## GCV = 0.67639  Scale est. = 0.525     n = 42
mod30$aic
## [1] 102.287
plot(mod30, pages=1, scheme=1, unconditional=TRUE, main = "Windowpane")
## Warning in plot.gam(mod30, pages = 1, scheme = 1, unconditional = TRUE, :
## Smoothness uncertainty corrected covariance not available

gam.check(mod30)

## 
## Method: GCV   Optimizer: magic
## Smoothing parameter selection converged after 10 iterations.
## The RMS GCV score gradient at convergence was 7.4314e-07 .
## The Hessian was positive definite.
## Model rank =  19 / 19 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##           k'  edf k-index p-value
## s(year) 9.00 6.71    1.43    0.99
## s(z_bt) 9.00 1.69    1.17    0.87
## Buckler Dory
### GLM
dc_fall_b.d <- filter(dc_fall, svspp == 'Buckler.Dory')
b.d_plot_f <- ggplot(data = dc_fall_b.d, aes(x = year, y = cb)) +
  geom_point(color = "black", size = 1) +
  ecodata::geom_gls() +
  theme_bw() +
  theme(plot.title = element_text(size = 13)) +
  xlab("Year") +
  ylab("Consumption:Biomass") +
  scale_x_continuous(expand = expansion(mult = c(0.02, 0.02))) +
  scale_y_continuous(expand = expansion(mult = c(0.02, 0.02))) +
  theme(axis.text.x=element_text(size=10), 
        axis.text.y = element_text(size=10),
        axis.title.y=element_text(size = 10),
        axis.title.x=element_text(size = 10)) +
  ggtitle("Buckler Dory")
b.d_plot_f
## N < 30

### GAM
dc_fall_b.d <- filter(dc_fall, svspp == 'Buckler.Dory')
dc_fall_b.d$z_bt <- (dc_fall_b.d$bt - mean(dc_fall_b.d$bt))/(dc_fall_b.d$bt_sd)
mod31 <- gam(cb ~ s(year), data=dc_fall_b.d, family = 'gaussian')
mod31.a <- gam(cb ~ s(z_bt), data=dc_fall_b.d, family = 'gaussian')
summary(mod31)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## cb ~ s(year)
## 
## Parametric coefficients:
##             Estimate Std. Error t value Pr(>|t|)   
## (Intercept)   0.7138     0.2177   3.278    0.007 **
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##           edf Ref.df     F p-value
## s(year) 1.552  1.912 0.671   0.456
## 
## R-sq.(adj) =  0.0579   Deviance explained =   17%
## GCV = 0.81158  Scale est. = 0.66365   n = 14
summary(mod31.a)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## cb ~ s(z_bt)
## 
## Parametric coefficients:
##             Estimate Std. Error t value Pr(>|t|)   
## (Intercept)   0.7138     0.2148   3.323  0.00608 **
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##         edf Ref.df     F p-value
## s(z_bt)   1      1 2.176   0.166
## 
## R-sq.(adj) =  0.083   Deviance explained = 15.4%
## GCV = 0.75367  Scale est. = 0.646     n = 14
mod31$aic
## [1] 38.27672
mod31.a$aic
## [1] 37.45481
plot(mod31, pages=1, scheme=1, unconditional=TRUE, main = "Buckler Dory")
## Warning in plot.gam(mod31, pages = 1, scheme = 1, unconditional = TRUE, :
## Smoothness uncertainty corrected covariance not available

plot(mod31.a, pages=1, scheme=1, unconditional=TRUE, main = "Buckler Dory")
## Warning in plot.gam(mod31.a, pages = 1, scheme = 1, unconditional = TRUE, :
## Smoothness uncertainty corrected covariance not available

gam.check(mod14)

## 
## Method: GCV   Optimizer: magic
## Smoothing parameter selection converged after 4 iterations.
## The RMS GCV score gradient at convergence was 2.394827e-06 .
## The Hessian was positive definite.
## Model rank =  10 / 10 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##         k'  edf k-index p-value
## s(bt) 9.00 3.58    1.53    0.99
gam.check(mod14.a)

## 
## Method: GCV   Optimizer: magic
## Smoothing parameter selection converged after 4 iterations.
## The RMS GCV score gradient at convergence was 2.394827e-06 .
## The Hessian was positive definite.
## Model rank =  10 / 10 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##         k'  edf k-index p-value
## s(bt) 9.00 3.58    1.53    0.99
## Blue Fish
### GLM
dc_fall_b.f <- filter(dc_fall, svspp == 'Buckler.Dory')
b.f_plot_f <- ggplot(data = dc_fall_b.f, aes(x = year, y = cb)) +
  geom_point(color = "black", size = 1) +
  ecodata::geom_gls() +
  theme_bw() +
  theme(plot.title = element_text(size = 13)) +
  xlab("Year") +
  ylab("Consumption:Biomass") +
  scale_x_continuous(expand = expansion(mult = c(0.02, 0.02))) +
  scale_y_continuous(expand = expansion(mult = c(0.02, 0.02))) +
  theme(axis.text.x=element_text(size=10), 
        axis.text.y = element_text(size=10),
        axis.title.y=element_text(size = 10),
        axis.title.x=element_text(size = 10)) +
  ggtitle("Blue Fish")
b.f_plot_f
## N < 30

### GAM
dc_fall_b.f <- filter(dc_fall, svspp == 'Blue.Fish')
dc_fall_b.f$z_bt <- (dc_fall_b.f$bt - mean(dc_fall_b.f$bt))/(dc_fall_b.f$bt_sd)
mod32 <- gam(cb ~ s(year), data=dc_fall_b.f, family = 'gaussian')
mod32.a <- gam(cb ~ s(z_bt), data=dc_fall_b.f, family = 'gaussian')
summary(mod32)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## cb ~ s(year)
## 
## Parametric coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)   1.0768     0.1418   7.593 2.43e-09 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##         edf Ref.df     F p-value
## s(year)   1      1 2.708   0.107
## 
## R-sq.(adj) =  0.0391   Deviance explained =  6.2%
## GCV = 0.90701  Scale est. = 0.86482   n = 43
summary(mod32.a)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## cb ~ s(z_bt)
## 
## Parametric coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)    1.077      0.145   7.424 4.44e-09 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##           edf Ref.df     F p-value
## s(z_bt) 1.397  1.676 0.447   0.706
## 
## R-sq.(adj) =  -0.00521   Deviance explained = 2.82%
## GCV = 0.95808  Scale est. = 0.90468   n = 43
mod32$aic
## [1] 119.7357
mod32.a$aic
## [1] 122.0486
plot(mod32, pages=1, scheme=1, unconditional=TRUE, main = "Blue Fish")
## Warning in plot.gam(mod32, pages = 1, scheme = 1, unconditional = TRUE, :
## Smoothness uncertainty corrected covariance not available

plot(mod32.a, pages=1, scheme=1, unconditional=TRUE, main = "Blue Fish")
## Warning in plot.gam(mod32.a, pages = 1, scheme = 1, unconditional = TRUE, :
## Smoothness uncertainty corrected covariance not available

gam.check(mod32)

## 
## Method: GCV   Optimizer: magic
## Smoothing parameter selection converged after 13 iterations.
## The RMS GCV score gradient at convergence was 1.442805e-07 .
## The Hessian was positive definite.
## Model rank =  10 / 10 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##         k' edf k-index p-value
## s(year)  9   1    0.88    0.14
gam.check(mod32.a)

## 
## Method: GCV   Optimizer: magic
## Smoothing parameter selection converged after 5 iterations.
## The RMS GCV score gradient at convergence was 5.428816e-06 .
## The Hessian was positive definite.
## Model rank =  10 / 10 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##          k' edf k-index p-value
## s(z_bt) 9.0 1.4    1.04    0.46
## Longhorn Sculpin
### GLM
dc_fall_l.s <- filter(dc_fall, svspp == 'Longhorn.Sculpin')
l.s_plot_f <- ggplot(data = dc_fall_l.s, aes(x = year, y = cb)) +
  geom_point(color = "black", size = 1) +
  ecodata::geom_gls() +
  theme_bw() +
  theme(plot.title = element_text(size = 13)) +
  xlab("Year") +
  ylab("Consumption:Biomass") +
  scale_x_continuous(expand = expansion(mult = c(0.02, 0.02))) +
  scale_y_continuous(expand = expansion(mult = c(0.02, 0.02))) +
  theme(axis.text.x=element_text(size=10), 
        axis.text.y = element_text(size=10),
        axis.title.y=element_text(size = 10),
        axis.title.x=element_text(size = 10)) +
  ggtitle("Longhorn Sculpin")
l.s_plot_f

### GAM
dc_fall_l.s <- filter(dc_fall, svspp == 'Longhorn.Sculpin')
dc_fall_l.s$z_bt <- (dc_fall_l.s$bt - mean(dc_fall_l.s$bt))/(dc_fall_l.s$bt_sd)
mod33 <- gam(cb ~ s(year) + s(z_bt), data=dc_fall_l.s, family = 'gaussian')
summary(mod33)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## cb ~ s(year) + s(z_bt)
## 
## Parametric coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  0.42171    0.04551   9.267 1.24e-10 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##           edf Ref.df     F p-value  
## s(year) 3.345  4.087 1.846  0.1402  
## s(z_bt) 3.212  3.795 2.178  0.0942 .
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.236   Deviance explained = 36.5%
## GCV = 0.10213  Scale est. = 0.082835  n = 40
mod33$aic
## [1] 22.61746
plot(mod33, pages=1, scheme=1, unconditional=TRUE, main = "Longhorn Sculpin")
## Warning in plot.gam(mod33, pages = 1, scheme = 1, unconditional = TRUE, :
## Smoothness uncertainty corrected covariance not available

gam.check(mod33)

## 
## Method: GCV   Optimizer: magic
## Smoothing parameter selection converged after 4 iterations.
## The RMS GCV score gradient at convergence was 5.262473e-06 .
## The Hessian was positive definite.
## Model rank =  19 / 19 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##           k'  edf k-index p-value
## s(year) 9.00 3.35    1.04    0.54
## s(z_bt) 9.00 3.21    1.06    0.52
## Striped Searobin
### GLM
dc_fall_s.s <- filter(dc_fall, svspp == 'Striped.Searobin')
s.s_plot_f <- ggplot(data = dc_fall_s.s, aes(x = year, y = cb)) +
  geom_point(color = "black", size = 1) +
  ecodata::geom_gls() +
  theme_bw() +
  theme(plot.title = element_text(size = 13)) +
  xlab("Year") +
  ylab("Consumption:Biomass") +
  scale_x_continuous(expand = expansion(mult = c(0.02, 0.02))) +
  scale_y_continuous(expand = expansion(mult = c(0.02, 0.02))) +
  theme(axis.text.x=element_text(size=10), 
        axis.text.y = element_text(size=10),
        axis.title.y=element_text(size = 10),
        axis.title.x=element_text(size = 10)) +
  ggtitle("Striped Searobin")
s.s_plot_f
## N < 30

### GAM
dc_fall_s.s <- filter(dc_fall, svspp == 'Striped.Searobin')
dc_fall_s.s$z_bt <- (dc_fall_s.s$bt - mean(dc_fall_s.s$bt))/(dc_fall_s.s$bt_sd)
mod34 <- gam(cb ~ s(year), data=dc_fall_s.s, family = 'gaussian')
mod34.a <- gam(cb ~ s(bt), data=dc_fall_s.s, family = 'gaussian')
summary(mod34)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## cb ~ s(year)
## 
## Parametric coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)   2.0645     0.2227   9.271  4.9e-07 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##           edf Ref.df     F p-value
## s(year) 1.213  1.395 1.651   0.174
## 
## R-sq.(adj) =  0.126   Deviance explained = 20.2%
## GCV = 0.87246  Scale est. = 0.74375   n = 15
summary(mod34.a)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## cb ~ s(bt)
## 
## Parametric coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)   2.0645     0.1685   12.25 4.86e-07 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##         edf Ref.df    F p-value  
## s(bt) 4.718  5.647 2.86  0.0803 .
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =    0.5   Deviance explained = 66.8%
## GCV = 0.68832  Scale est. = 0.42592   n = 15
mod34$aic
## [1] 42.159
mod34.a$aic
## [1] 36.00201
plot(mod34, pages=1, scheme=1, unconditional=TRUE, main = "Striped Searobin")
## Warning in plot.gam(mod34, pages = 1, scheme = 1, unconditional = TRUE, :
## Smoothness uncertainty corrected covariance not available

plot(mod34.a, pages=1, scheme=1, unconditional=TRUE, main = "Striped Searobin")
## Warning in plot.gam(mod34.a, pages = 1, scheme = 1, unconditional = TRUE, :
## Smoothness uncertainty corrected covariance not available

gam.check(mod34)

## 
## Method: GCV   Optimizer: magic
## Smoothing parameter selection converged after 7 iterations.
## The RMS GCV score gradient at convergence was 4.696964e-06 .
## The Hessian was positive definite.
## Model rank =  10 / 10 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##           k'  edf k-index p-value
## s(year) 9.00 1.21    1.32    0.84
gam.check(mod34.a)

## 
## Method: GCV   Optimizer: magic
## Smoothing parameter selection converged after 6 iterations.
## The RMS GCV score gradient at convergence was 1.212768e-07 .
## The Hessian was positive definite.
## Model rank =  10 / 10 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##         k'  edf k-index p-value
## s(bt) 9.00 4.72    1.37    0.83

Combining all of the above GLMs into one figure for comparison purposes:

glm_cb_f <- ggarrange(s.d_plot_f, w.s_plot_f, p_plot_f, w.h_plot_f, r.h_plot_f,g_plot_f, t.s_plot_f, a.c_plot_f, s.r_plot_f, s.h_plot_f,s.f_plot_f, f.f_plot_f, w_plot_f, b.d_plot_f, b.f_plot_f,l.s_plot_f, s.s_plot_f, ncol = 5, nrow = 4)
## N < 30
## N < 30
## N < 30
glm_cb_f

Comparing GAMs side by side for all species of trends in consumption:biomass ratios: (*Same note as the above combined set of GAMs)

par(mfrow=c(3,3))
mod18 <- gam(cb ~ s(year), data=dc_fall_s.d, family = 'gaussian')
plot(mod18, scheme=1, unconditional=TRUE, main = "Spiny Dogfish") 
## Warning in plot.gam(mod18, scheme = 1, unconditional = TRUE, main = "Spiny
## Dogfish"): Smoothness uncertainty corrected covariance not available
mod19 <- gam(cb ~ s(year), data=dc_fall_w.s, family = 'gaussian')
plot(mod19, scheme=1, unconditional=TRUE, main = "Winter Skate") 
## Warning in plot.gam(mod19, scheme = 1, unconditional = TRUE, main = "Winter
## Skate"): Smoothness uncertainty corrected covariance not available
mod20 <- gam(cb ~ s(year), data=dc_fall_p, family = 'gaussian')
plot(mod20, scheme=1, unconditional=TRUE, main = "Pollock") 
## Warning in plot.gam(mod20, scheme = 1, unconditional = TRUE, main = "Pollock"):
## Smoothness uncertainty corrected covariance not available
mod21 <- gam(cb ~ s(year), data=dc_fall_w.h, family = 'gaussian')
plot(mod21, scheme=1, unconditional=TRUE, main = "White Hake")
## Warning in plot.gam(mod21, scheme = 1, unconditional = TRUE, main = "White
## Hake"): Smoothness uncertainty corrected covariance not available
mod22 <- gam(cb ~ s(year), data=dc_fall_r.h, family = 'gaussian')
plot(mod22, scheme=1, unconditional=TRUE, main = "Red Hake")
## Warning in plot.gam(mod22, scheme = 1, unconditional = TRUE, main = "Red Hake"):
## Smoothness uncertainty corrected covariance not available
mod23 <- gam(cb ~ s(year), data=dc_fall_g, family = 'gaussian')
plot(mod23, scheme=1, unconditional=TRUE, main = "Goosefish")
## Warning in plot.gam(mod23, scheme = 1, unconditional = TRUE, main =
## "Goosefish"): Smoothness uncertainty corrected covariance not available
mod24 <- gam(cb ~ s(year), data=dc_fall_t.s, family = 'gaussian')
plot(mod24, scheme=1, unconditional=TRUE, main = "Thorny Skate")
## Warning in plot.gam(mod24, scheme = 1, unconditional = TRUE, main = "Thorny
## Skate"): Smoothness uncertainty corrected covariance not available
mod25 <- gam(cb ~ s(year), data=dc_fall_a.c, family = 'gaussian')
plot(mod25, scheme=1, unconditional=TRUE, main = "Atlantic Cod")
## Warning in plot.gam(mod25, scheme = 1, unconditional = TRUE, main = "Atlantic
## Cod"): Smoothness uncertainty corrected covariance not available
mod26 <- gam(cb ~ s(year), data=dc_fall_s.r, family = 'gaussian')
plot(mod26, scheme=1, unconditional=TRUE, main = "Sea Raven")
## Warning in plot.gam(mod26, scheme = 1, unconditional = TRUE, main = "Sea
## Raven"): Smoothness uncertainty corrected covariance not available

mod27 <- gam(cb ~ s(year), data=dc_fall_s.h, family = 'gaussian')
plot(mod27, scheme=1, unconditional=TRUE, main = "Silver Hake")
## Warning in plot.gam(mod27, scheme = 1, unconditional = TRUE, main = "Silver
## Hake"): Smoothness uncertainty corrected covariance not available
mod28 <- gam(cb ~ s(year), data=dc_fall_s.f, family = 'gaussian')
plot(mod28, scheme=1, unconditional=TRUE, main = "Summer Flounder")
## Warning in plot.gam(mod28, scheme = 1, unconditional = TRUE, main = "Summer
## Flounder"): Smoothness uncertainty corrected covariance not available
mod29 <- gam(cb ~ s(year), data=dc_fall_f.f, family = 'gaussian')
plot(mod29, scheme=1, unconditional=TRUE, main = "Fourspot Flounder")
## Warning in plot.gam(mod29, scheme = 1, unconditional = TRUE, main = "Fourspot
## Flounder"): Smoothness uncertainty corrected covariance not available
mod30 <- gam(cb ~ s(year), data=dc_fall_w, family = 'gaussian')
plot(mod30, scheme=1, unconditional=TRUE, main = "Windowpane")
## Warning in plot.gam(mod30, scheme = 1, unconditional = TRUE, main =
## "Windowpane"): Smoothness uncertainty corrected covariance not available
mod31 <- gam(cb ~ s(year), data=dc_fall_b.d, family = 'gaussian')
plot(mod31, scheme=1, unconditional=TRUE, main = "Buckler Dory")
## Warning in plot.gam(mod31, scheme = 1, unconditional = TRUE, main = "Buckler
## Dory"): Smoothness uncertainty corrected covariance not available
mod32 <- gam(cb ~ s(year), data=dc_fall_b.f, family = 'gaussian')
plot(mod32, scheme=1, unconditional=TRUE, main = "Blue Fish")
## Warning in plot.gam(mod32, scheme = 1, unconditional = TRUE, main = "Blue
## Fish"): Smoothness uncertainty corrected covariance not available
mod33 <- gam(cb ~ s(year), data=dc_fall_l.s, family = 'gaussian')
plot(mod33, scheme=1, unconditional=TRUE, main = "Longhorn Sculpin")
## Warning in plot.gam(mod33, scheme = 1, unconditional = TRUE, main = "Longhorn
## Sculpin"): Smoothness uncertainty corrected covariance not available
mod34 <- gam(cb ~ s(year), data=dc_fall_s.s, family = 'gaussian')
plot(mod34, scheme = 1, unconditional=TRUE, main = "Striped Searobin")
## Warning in plot.gam(mod34, scheme = 1, unconditional = TRUE, main = "Striped
## Searobin"): Smoothness uncertainty corrected covariance not available
## GAM of bt v. cb --> same note as above
par(mfrow = c(3,3))

mod18 <- gam(cb ~ s(bt), data=dc_spring_s.d, family = 'gaussian')
plot(mod18, scheme=1, unconditional=TRUE, main = "Spiny Dogfish")
## Warning in plot.gam(mod18, scheme = 1, unconditional = TRUE, main = "Spiny
## Dogfish"): Smoothness uncertainty corrected covariance not available
mod19 <- gam(cb ~ s(bt), data=dc_spring_w.s, family = 'gaussian')
plot(mod19, scheme=1, unconditional=TRUE, main = "Winter Skate")
## Warning in plot.gam(mod19, scheme = 1, unconditional = TRUE, main = "Winter
## Skate"): Smoothness uncertainty corrected covariance not available
mod20 <- gam(cb ~ s(bt), data=dc_spring_p, family = 'gaussian')
plot(mod20, scheme=1, unconditional=TRUE, main = "Pollock")
## Warning in plot.gam(mod20, scheme = 1, unconditional = TRUE, main = "Pollock"):
## Smoothness uncertainty corrected covariance not available
mod21 <- gam(cb ~ s(bt), data=dc_spring_w.h, family = 'gaussian')
plot(mod21, scheme=1, unconditional=TRUE, main = "White Hake")
## Warning in plot.gam(mod21, scheme = 1, unconditional = TRUE, main = "White
## Hake"): Smoothness uncertainty corrected covariance not available
mod22 <- gam(cb ~ s(bt), data=dc_spring_r.h, family = 'gaussian')
plot(mod22, scheme=1, unconditional=TRUE, main = " Red Hake")
## Warning in plot.gam(mod22, scheme = 1, unconditional = TRUE, main = " Red
## Hake"): Smoothness uncertainty corrected covariance not available
mod23 <- gam(cb ~ s(bt), data=dc_spring_g, family = 'gaussian')
plot(mod23, scheme=1, unconditional=TRUE, main = "Goosefish")
## Warning in plot.gam(mod23, scheme = 1, unconditional = TRUE, main =
## "Goosefish"): Smoothness uncertainty corrected covariance not available
mod24 <- gam(cb ~ s(bt), data=dc_spring_t.s, family = 'gaussian')
plot(mod24, scheme=1, unconditional=TRUE, main = "Thorny Skate")
## Warning in plot.gam(mod24, scheme = 1, unconditional = TRUE, main = "Thorny
## Skate"): Smoothness uncertainty corrected covariance not available
mod25 <- gam(cb ~ s(bt), data=dc_spring_a.c, family = 'gaussian')
plot(mod25, scheme=1, unconditional=TRUE, main = "Atlantic Cod")
## Warning in plot.gam(mod25, scheme = 1, unconditional = TRUE, main = "Atlantic
## Cod"): Smoothness uncertainty corrected covariance not available
mod26 <- gam(cb ~ s(bt), data=dc_spring_s.r, family = 'gaussian')
plot(mod26, scheme=1, unconditional=TRUE, main = "Sea Raven")
## Warning in plot.gam(mod26, scheme = 1, unconditional = TRUE, main = "Sea
## Raven"): Smoothness uncertainty corrected covariance not available

mod27 <- gam(cb ~ s(bt), data=dc_spring_s.h, family = 'gaussian')
plot(mod27, scheme=1, unconditional=TRUE, main = "Silver Hake")
## Warning in plot.gam(mod27, scheme = 1, unconditional = TRUE, main = "Silver
## Hake"): Smoothness uncertainty corrected covariance not available
mod28 <- gam(cb ~ s(bt), data=dc_spring_s.f, family = 'gaussian')
plot(mod28, scheme=1, unconditional=TRUE, main = "Summer Flounder")
## Warning in plot.gam(mod28, scheme = 1, unconditional = TRUE, main = "Summer
## Flounder"): Smoothness uncertainty corrected covariance not available
mod29 <- gam(cb ~ s(bt), data=dc_spring_f.f, family = 'gaussian')
plot(mod29, scheme=1, unconditional=TRUE, main = "Fourspot Flounder")
## Warning in plot.gam(mod29, scheme = 1, unconditional = TRUE, main = "Fourspot
## Flounder"): Smoothness uncertainty corrected covariance not available
mod30 <- gam(cb ~ s(bt), data=dc_spring_w, family = 'gaussian')
plot(mod30, scheme=1, unconditional=TRUE, main = "Windowpane")
## Warning in plot.gam(mod30, scheme = 1, unconditional = TRUE, main =
## "Windowpane"): Smoothness uncertainty corrected covariance not available
mod31 <- gam(cb ~ s(bt) , data=dc_spring_b.d, family = 'gaussian')
plot(mod31, scheme=1, unconditional=TRUE, main = "Buckler Dory")
## Warning in plot.gam(mod31, scheme = 1, unconditional = TRUE, main = "Buckler
## Dory"): Smoothness uncertainty corrected covariance not available
mod32 <- gam(cb ~ s(bt), data=dc_spring_b.f, family = 'gaussian')
plot(mod32, scheme=1, unconditional=TRUE, main = "Blue Fish")
## Warning in plot.gam(mod32, scheme = 1, unconditional = TRUE, main = "Blue
## Fish"): Smoothness uncertainty corrected covariance not available
mod33 <- gam(cb ~ s(z_bt), data=dc_spring_l.s, family = 'gaussian')
plot(mod33, scheme=1, unconditional=TRUE, main = "Longhorn Sculpin")
## Warning in plot.gam(mod33, scheme = 1, unconditional = TRUE, main = "Longhorn
## Sculpin"): Smoothness uncertainty corrected covariance not available
mod34 <- gam(cb ~ s(z_bt), data=dc_spring_s.s, family = 'gaussian')
plot(mod34, scheme = 1, unconditional=TRUE, main = "Striped Searobin")
## Warning in plot.gam(mod34, scheme = 1, unconditional = TRUE, main = "Striped
## Searobin"): Smoothness uncertainty corrected covariance not available

Filtering data to examine bottom temperature trend:

dc_temp <- data_comb %>% 
  select('year','bt') %>% 
  na.omit('year','bt')

Bottom temperature trend across spring and fall:

bt_plot <- ggplot(data = dc_temp, 
       aes(x = year, y = bt)) +
  geom_point(color = "black", size = 1) +
  geom_smooth(method = lm, color = "purple2", linewidth = 2) +
  theme_bw() +
  theme(plot.title = element_text(size = 15)) +
  xlab("Year") +
  ylab("Bottom Temperature") +
  theme(axis.text.x=element_text(size=10), 
        axis.text.y = element_text(size=10),
        axis.title.y=element_text(size = 13),
        axis.title.x=element_text(size = 13)) +
  ggtitle("Bottom Temperature Over Time")
bt_plot
## `geom_smooth()` using formula = 'y ~ x'

Bottom temperature trend across fall:

bt_fall_plot <- ggplot(data = dc_fall, 
                  aes(x = year, y = bt)) +
  geom_point(color = "black", size = 1) +
  geom_smooth(method = lm, color = "purple2", linewidth = 2, se = FALSE) +
  theme_bw() +
  theme(plot.title = element_text(size = 15)) +
  xlab("Year") +
  ylab("Bottom Temperature") +
  theme(axis.text.x=element_text(size=10), 
        axis.text.y = element_text(size=10),
        axis.title.y=element_text(size = 13),
        axis.title.x=element_text(size = 13)) +
  ggtitle("Fall Bottom Temperature Over Time")
bt_fall_plot
## `geom_smooth()` using formula = 'y ~ x'

Bottom temperature trend across spring:

dc_spring <- filter(data_comb_f, seacat == 'SPRING')

bt_spring_plot <- ggplot(data = dc_spring, 
                       aes(x = year, y = bt)) +
  geom_point(color = "black", size = 1) +
  geom_smooth(method = lm, color = "purple2", linewidth = 2, se = FALSE) +
  theme_bw() +
  theme(plot.title = element_text(size = 15)) +
  xlab("Year") +
  ylab("Bottom Temperature") +
  theme(axis.text.x=element_text(size=10), 
        axis.text.y = element_text(size=10),
        axis.title.y=element_text(size = 13),
        axis.title.x=element_text(size = 13)) +
  ggtitle("Spring Bottom Temperature Over Time")
bt_spring_plot
## `geom_smooth()` using formula = 'y ~ x'